在redhat AS4 或者CENTOS 4.5上安装cacti等。
1、安装系统,打开远程桌面xmanager
在windows操作系统下通过xmanager图形化远程运行
安装以后,需要在linux机上设置以下内容:
Step 1. Change runlevel to enable gdm or kdm.
用编辑器vi、gedit等打开/etc/inittab 文件
id:5:initdefault:
改变运行模式为 5,当然如果你的机子默认进入x-window,则不用设置
Step 2. 设置GDM(如果你的机子运行的是gnome)注:rh9默认安装都是这个,所以如果你用的是
GNOME,则第三步不用进行操作
打开/etc/X11/gdm/gdm.conf file. (/etc/gdm/custom.conf for Fedora Core 5)
找到[xdmcp]se
改变 Enable 的值为 true or 1.
Step 3. 设置KDM(When如果你的机子用的是KDE。
打开文件 /etc/X11/xdm/xdm-config .
把 DisplayManager.requestPort: 0
改为 !DisplayManager.requestPort: 0
打开/etc/X11/xdm/Xaccess.
删除下面以行前面的#号:
#* #any host can get a login window
==>
* #any host can get a login window
打开文件 /etc/X11/xdm/kdmrc,
/usr/share/config/kdm/kdmrc 或者
/etc/opt/kde2/share/config/kdm/kdmrc .
改变"Enable" 的值为 "true".
Step 4. 设置防火墙(如果你设置防火墙的话)
如果我们的Linux机器配置有防火墙,需使防火墙通过177端口(即xdmcp服务)的数据过虑,
需加上如下的规则:
iptables -A INPUT -p udp -s 0/0 -d 0/0 --dport 177 -j ACCEPT
找到文件/etc/sysconfig/iptables,假如上面一行即可
Step 5. 冲起电脑。
刚刚测试完成,由于我用的是gnome,所以并没有测试kde,以上文章从xmanager官方网站翻译所得,并一点修改,就是最后防火墙的设置。
2、安装snmp
安装前请先检查系统中是否有snmpwalk和snmpget两个命令。如果有,则可以跳过以下步骤。
用rpm -qa |grep net-snm* 检查是否有以下5个包已安装。
net-snmp-libs-5.1.2-11.EL4.10
net-snmp-devel-5.1.2-11.EL4.10
net-snmp-perl-5.1.2-11.EL4.10
net-snmp-5.1.2-11.EL4.10
net-snmp-utils-5.1.2-11.EL4.10
上述文件可以在REDHAT 企业版第四张光盘中有只要吧net-snmp开头的所有包都装上就可以了。如果缺少net-snmp-utils-5.1.2-11.EL4.10就在系统的增加减少系统软件里在system tools里增加这个项目
3、安装mysql
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar zxvf mysql.tar.gz
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=all --with-big-tables --with-charset=utf8 --with-collation=utf8_unicode_ci
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql (初始化数据库)
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql & (启动服务器)
shell> mysqladmin -u root -p password '1234' (修改root用户密码)
shell> cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
shell> chmod 700 /etc/rc.d/init.d/mysqld
shell> chkconfig --add mysqld (以上三行作为mysql自动启动来用)
4、安装apache
解压httpd-2.0.59.tar.gz
# tar -zvxf httpd-2.0.59.tar.gz
进入httpd-2.0.59目录
# cd httpd-2.0.59
生成/usr/local/apache2目录
# mkdir -p /usr/local/apache2
配置安装目录
# ./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite
编译
# make
安装
# make install
安装完毕
#/usr/local/apache2/bin/apachectl -k start
启动测试
让apahce系统启动时自动启动
从/usr/local/apache2/bin/apachectl 到 /etc/rc.d/init.d/httpd 建立一个符号连接:
# ln -s /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
然后在此文件总添加以下几行(大概在文件顶部,约第二行的地方):
# chkconfig: 2345 30 100
# description: Activates/Deactivates Apache Web Server
最后,运行chkconfig把Apache添加到系统的启动服务组里面:
# /sbin/chkconfig --del httpd
# /sbin/chkconfig --add httpd
另外一种方法系统启动时加载apache
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
cd /etc/rc.d/rc3.d
ln -s ../init.d/httpd S80httpd
安装 libxml2
tar -zxvf libxml2-2.6.19.tar.gz
cd libxml2-2.6.19
./configure --prefix=/usr/local/libxml2
make
make install
这一步结束时,libxml2被安装在/usr/local/下。
安装 zlib
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
这一步结束时,zlib被安装在/usr/local/下。
安装 libpng
tar -zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
cp scripts/makefile.linux makefile
make
make install
注意:这里的makefile不是用./configure 生成的,而是直接从script/目录里拷一个
这一步结束时,zlib被安装在/usr/local/lib下
安装 freetype
tar -zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure --prefix=/usr/local/freetype
make
make install
这一步结束时,freetype被安装在/usr/local/lib下
安装 jpeg6
建立目录
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install
注意:这里./configure一定要带--enable-shared参数,不然,不会生成共享库
安装 gd
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd --with-png=/usr/local/lib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6
make && make install
安装php5需要gd2的支持,但在安装过程中,执行编译的时候出现下面的错误:
root@web1 gd-2.0.35]# make
cd . && /bin/sh /root/gd-2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
cd . && /bin/sh /root/gd-2.0.35/config/missing --run automake-1.9 --foreign
cd . && /bin/sh /root/gd-2.0.35/config/missing --run autoconf
configure.ac:64: error: possibly undefined macro: AM_ICONV
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
make: *** [configure] Error 1
把报错信息“configure.ac:64: error: possibly undefined macro: AM_ICONV”拿到google里搜索,得到“But you need to have gettext”没有gettext这个包。
那好吧,我们来安装这个gettext。在centos 5里,默认安装了包管理工具,为了省事赶时间,拿它来试试。其过程如下:
[root@web1 gd-2.0.35]#yum install gettext
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Parsing package install arguments
Nothing to do
很快就装好了,再执行make编译命令,一切ok!
注:用YUM只是权宜之计,并不是上上之选.因此强烈建议使用GNU源码
安装PHP
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/etc --with-libxml-dir=/usr/local/libxml2 --with-zlib-dir=/usr/local/zlib --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl --enable-gd-native-ttf --enable-mbstring --enable-ftp --enable-bcmath --enable-sockets --enable-zip --enable-soap --enable-calendar
make
make install
cp php.ini-dist /etc/php.ini
整合apache2和php5
apache 配置文件及目录是:
/usr/local/apache2/conf/httpd.conf
apache 默认存放主页的位置是:
/usr/local/apache2/htdocs
以下是配置文件里面的信息:(有的地方要做修改)
ServerRoot "/usr/local/apache2"
这是指定apache程序所在的目录,比如日志文件、配置文件等目录。
DocumentRoot "/usr/local/apache2/htdocs"
这个是存放网页的目录
这一句应该和DocumentRoot的目录保持一致。
找到 DirectoryIndex index.html
改为 DirectoryIndex index.html index.html.var index.htm index.php
找到 AddType application/x-gzip .gz .tgz
加 AddType application/x-httpd-php .php (注意空格)
AddType application/x-httpd-php-source .phps
添加 AddDefaultCharset utf8 使apache默认支持utf8字符集
保存配置文件就重启apache 的守护进程。
/usr/local/apache2/bin/apachectl restart
注意:
每次更改配置文件。要重启服务。
对存放网页的目录执行:命令chmod 755 目录名 或者 chmod -R 755 目录名
编辑php.ini文件,找到
;default_charset="iso-8859-1"
增加一行:default_charset="utf8"
以上步骤都执行完后。在/usr/local/apache2/htdocs/里编辑文件进行测试。
phpinfo.php
里面的内容:
phpinfo();
?>
在浏览器地址栏中输入:
http://localhost/phpinfo.php
出现php说明页面说明安装成功。
安装phpmyadmin没什么好说的。解压cp过去就差不多了。
安装ftp服务器pureftpd(通过web来管理虚拟用户和mysql结合)
ftp服务器pure-ftpd-1.0.21 下载地址http://www.pureftpd.org/project/pure-ftpd
用户管理软件user_manager_pureftpd 下载地址http://machiel.generaal.net/index.php?subject=user_manager_pureftpd&button=ducumentation
#cp /usr/local/mysql/lib/mysql/*.* /usr/lib/
这一步是吧mysql客户端的一些库文件放到pureftpd默认目录奇否则编译错误
#./configure --prefix=/usr/local/pureftpd --with-mysql=/usr/local/mysql --with-puredb --with-paranoidmsg --with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-pam --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-language=simplified-chinese
#make
#make check
#make install
#cd configuration-file
#chmod u+x pure-config.pl
#cp pure-config.pl /usr/local/sbin/
#cp pure-ftpd.conf /usr/local/etc/
#cd ..
#cp pure-ftpd-mysql.conf /usr/local/etc/
我们来编辑最重要的文件 /usr/local/etc/pure-ftpd.conf
修改pureftpd配置文件/usr/local/etc/pure-ftpd.conf,在这里只列出需要更改的几处
# Cage in every user in his home directory
# 限制每个用户到自己的根目录
ChrootEveryone yes
# Disallow anonymous connections. Only allow authenticated users.
# 取消anonymous用户
NoAnonymous yes
# MySQL configuration file (see README.MySQL)
# pureftpd-mysql.conf文件的位置
MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf
添加FTP用户和组
# groupadd ftpusers
# useradd -g ftpusers -s /sbin/nologin -d /var/ftp ftpusers
我们来编辑 /usr/local/etc/pureftpd-mysql.conf
在安装User manager for PureFTPd时在step6会出先一个配置好的文本。copy下来在这里用。
启动pureftpd
#/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
在/etc/rc.d/rc.local中加入
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf > /dev/null 2>&1
启动脚本设置
cp pure-ftpd-1.0.18/contrib/redhat.init /etc/rc.d/init.d/pureftpd
然后修改该脚本的可执行属性:
chmod +x /etc/rc.d/init.d/pureftpd
然后编辑:
vi /etc/rc.d/init.d/pureftpd
修改 fullpath=/usr/local/sbin/$prog
为
fullpath=/usr/local/pureftpd/bin/$prog
修改 $fullpath /etc/pure-ftpd.conf --daemonize
为
$fullpath /usr/local/pureftpd/etc/pure-ftpd.conf --daemonize
然后运行命令:chkconfig --level 35 pureftpd on
则下次系统启动以后,pureftpd将自动启动.
以后也可以用/etc/rc.d/init.d/pureftpd这个教本来启动,停止,重启pureftpd
安装User manager for PureFTPd
把文件解压到一个web目录进入这个目录
#chmod 777 config.php
然后在浏览器里输入http://yourip/youraddress/install.php按照说明一步一步进行操作即可。