This is the first step to install and configure Nagios and Cacti in linux, that is, to configure a web environment. Here the lamp architecture is used! The linux platform RHEL5.4 is used here. The first version is mysql compilation and installation (both GCC and MAKE are installed, and other suites are installed as needed) [root @ localhosthttpd] # useraddmysql [root @
This is the first step for installing and configuring Nagios and Cacti in linux, that is, to configure a web environment. Here we use lampArchitecture!
The linux platform used here is RHEL 5.4.
First, compile and install mysql (both GCC and MAKE must be installed, and other suites must be installed as needed)
[Root @ localhostHttpd] # UseraDdMysql
[Root @ localhost ~] # Ll mysql-5.1.59.tar.gz
-Rw-r -- 1 root 24325443 Oct 14 mysql-5.1.59.tar.gz
[Root @ localhost ~] # Tar zxvf mysql-5.1.59.tar.gz
[Root @ localhost mysql-5.1.59] #./configure -- prefix =/usr/local/mysql --Enable-Local-inFile-- With-charSet= Gbk ---ExTrA-charsets = all -- with-low-memory -- with-mysqld-user = mysql -- enable-thread-safe-client
[Root @ localhost mysql-5.1.59] # make & make install
[Root @ localhost mysql-5.1.59] #Cd/Usr/local/mysql/
[Root @ localhost mysql] #Chown-R mysql. mysql.
[Root @ localhost mysql] #./bin/mysql_install_db -- user = mysql
[Root @ localhost mysql] # chown-R root.
[Root @ localhost mysql] # chown-R mysql/var/
[Root @ localhost mysql] #./bin/mysqld_safe -- user = mysql &
[Root @ localhost mysql] # netStat-TuLnP |Grep3306
TCp0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 20438/mysqld
[Root @ localhost mysql] # cd ~ (This part is the startup Item for mysql)
[Root @ localhost ~] # Echo "/usr/local/mysql/lib/mysql">/etc/ld. so. conf
[Root @ localhost ~] # Ldconfig-v
[Root @ localhost ~] # Ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql
[Root @ localhost ~] # Cp mysql-5.1.59/SuPport-files/mysql. server/etc/init. d/mysqld
[Root @ localhost ~] #Chmod775/etc/init. d/mysqld
[Root @ localhost ~] # Cp mysql-5.1.59/support-files/my-mEdIum. cnf/etc/my-cnf
[Root @ localhost ~] #Chkconfig-- Add mysqld
[Root @ localhost ~] # Chkconfig mysqld on
[Root @ localhost ~] # Chkconfig -- list | grep mysqld
Mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6:
Next, compile and install apache.
[Root @ localhost ~] # Ll httpd-2.2.6.tar.gz
-Rw-r -- 1 root 6028951 Sep 6 2007 httpd-2.2.6.tar.gz
[Root @ localhost ~] # Tar zxvf httpd-2.2.6.tar.gz
[Root @ localhost ~] # Cd httpd-2.2.6
[Root @ localhost httpd-2.2.6] #./configure -- prefix =/usr/local/httpd -- enable-so -- enable-reWrite-- Enable-ssl -- with-ssl =/usr/local/openssl
-- With-zlib -- enable-mods-shared = all -- enable-track-vars -- with-mysql =/usr/local/mysql
[Root @ localhost httpd-2.2.6] # make & make install
[Root @ localhost httpd-2.2.6] # echo "/usr/local/httpd/bin/ApachectlStart ">/etc/rc. local
[Root @ localhost httpd-2.2.6] #/usr/local/httpd/bin/apachectl start
[Root @ localhost httpd-2.2.6] #Netstat-Tulnp | grep 80
Tcp 0 0: 80: * LISTEN 19055/httpd
AddPhpSupport
[Root @ localhost ~] # Cd/usr/local/httpd/conf/
[Root @ localhost conf] # cp httpd. conf httpd. conf. bak
[Root @ localhost conf] # vi httpd. conf (the red font indicates the modified part)
DocumentRoot "/var/www"
Options FollowSymLinks
AllowOverrIdE None
Order deny, allow
Allow from all
AddType appliCatIon/x-httpd-php. php
AddType application/x-httpd-php-source. phps
Finally, php compilation and Installation
[Root @ localhost ~] # Ll php-5.2.5.tar.gz
-Rw-r -- 1 root 9972372 Jan 3 2008 php-5.2.5.tar.gz
[Root @ localhost ~] # Tar zxvf php-5.2.5.tar.gz
[Root @ localhost php-5.2.5] #./configure -- prefix =/usr/local/php \
> -- With-config-file-path =/etc \
> -- With-apxs2 =/usr/local/httpd/bin/apxs \
> -- Enable-fastcgi -- enable-safe-mode \
> -- With-zlib -- with-bz2 \
> ---FreeType-dir \
> -- Enable-mbstring \
> -- With-mysql =/usr/local/mysql \
> -- With-mysqli =/usr/local/mysql/bin/mysql_config \
> -- With-gd -- with-libxml-dir \
> -- With-png-dir -- with-jepg-dir -- enable-sockets
[Root @ localhost php-5.2.5] # make & make install
If php is already installed in rpm mode on the local machine, perform the red font below
[Root @ localhost php-5.2.5] # yum-y remove php *
[Root @ localhost php-5.2.5] # cp php. ini-dist/etc/php. ini
Last test
[Root @ localhost ~] # Cd/var/www/
[Root @ localhost www] # vi info. php
Phpinfo ();
?>
[Root @ localhost www] # cp/usr/local/httpd/htdocs/index.html.
Restart the service to go To the php classic page, indicating that the page is successful!
To sum up, this experiment aims to build the web environment required by Nagios and Cacti. The next experiment will go to the Nagios and Cacti sections!