天兔监控
搭建LAMP环境(手动)
编译安装httpd服务
创建目录
[[email protected] ~]#mkdir /tools
上传包
https://pan.baidu.com/s/1-hLsq3DXw0e4JJLh-2CkTA
百度云盘
[[email protected] tools]#tar xf httpd-2.2.31.tar.gz
[[email protected] tools]#cd httpd-2.2.31
[[email protected] httpd-2.2.31]#useradd www -s /sbin/nologin -M
安装必要的软件包zlib
[[email protected]]# yum install zlib zlib-devel –y
执行配置文件并安装
[[email protected]]# ./configure --prefix=/application/apache2.2.31 --enable-deflate
–enable-expires --enable-headers --enable-modules=most --enable-so
–with-mpm=worker --enable-rewrite
[[email protected]]# echo $? 显示0就对了
[[email protected]]# make && make install
创建软链接并开启服务
[[email protected]]# ln -s /application/apache2.2.31/ /application/apache
[[email protected]#/application/apache/bin/apachectl start
[[email protected]]# netstat -lntup|grep http
基于apache虚拟主机的配置
以www.abc.com为例来配置一个主页
[[email protected]]# cd /application/apache/htdocs/
[[email protected] htdocs]#mkdir www
修改页面配置httpd.conf文件
[[email protected] htdocs]#vim /application/apache/conf/httpd.conf
搜索/httpd-v,将前面的注释去除。
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
编辑与配置http页面文件httpd-vhosts.conf
[[email protected] htdocs]#vim /application/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot"/application/apache2.2.31/htdocs/www"
ServerName www.abc.com
ServerAlias abc.com
ErrorLog "logs/www_error_log"
CustomLog "logs/www_access_log"common
</VirtualHost>
建立一个首页文件用于测试页面是否正常
[[email protected] htdocs]#echo ‘Apache www’ >www/index.html
重启服务器刷新配置
[[email protected] htdocs]#/application/apache/bin/apachectl -t
[[email protected] htdocs]#
/application/apache/bin/apachectl graceful
测试web页面
安装mysql
[[email protected] htdocs]#cd /tools
[[email protected] tools]#useradd -s /sbin/nologin -M mysql
[[email protected] tools]#tar xf mysql-5.5.49-linux2.6-x86_64.tar.gz
[[email protected] tools]#mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49
[[email protected] tools]#
ln -s /application/mysql-5.5.49/ /application/mysql
[[email protected] tools]#
chown -R mysql:mysql /application/mysql
[[email protected] tools]#
cd /application/mysql
[[email protected] mysql]#
./scripts/mysql_install_db --basedir=/application/mysql/
–datadir=/application/mysql/data/ --user=mysql
[[email protected] mysql]#
echo $? 返回结果为零就对了
mysql调试并开启数据库
[[email protected] mysql]#cd bin/
[[email protected] bin]#sed -i ‘s#/usr/local/#/application/#g’ mysqld_safe
[[email protected] bin]# cd …/
[[email protected] mysql]#
\cp support-files/my-small.cnf /etc/my.cnf
[[email protected] mysql]#
echo ‘export PATH=/application/mysql/bin:$PATH’ >>/etc/profile
[[email protected] mysql]#
. /etc/profile
[[email protected] mysql]#
sed -i ‘s#/usr/local/#/application/#g’ support-files/mysql.server
[[email protected] mysql]#
cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql]#
chmod +x /etc/init.d/mysqld
[[email protected] mysql]#
chkconfig --add mysqld
[[email protected] mysql]#
/etc/init.d/mysqld start
php5.5.32的安装
[[email protected] mysql]#
cd /tools/
[[email protected] tools]#
tar xf libiconv-1.14.tar.gz
[[email protected] tools]#
cd libiconv-1.14
[[email protected]]# ./configure --prefix=/usr/local/libiconv
[[email protected]]# echo $? 返回只是0就对了
[[email protected]]# make && make install
[[email protected]]# ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
[[email protected]]# touch ext/phar/phar.phar
[[email protected]]# make && make install
[[email protected]]# ln -s /application/php5.5.32 /application/php
[[email protected]]# cp php.ini-production /application/php/lib/php.ini
[[email protected]]# cd /application/php/etc
[[email protected] etc]# cp
php-fpm.conf.default php-fpm.conf
[[email protected] etc]#grep libphp5.so /application/apache/conf/httpd.conf
[[email protected] etc]# ls /application/apache/modules/
[[email protected] etc]#/application/php/sbin/php-fpm
http与php模块以及mysql的结合
[[email protected] etc]#vim /application/apache/conf/httpd.conf
在/application/apache/conf/httpd.conf文件的第311行增加如下内容:
AddType application/x-httpd-php.html .htm .php .phtml
AddType application/x-httpd-php-source.html .htm .phps
在168行修改:
DirectoryIndex index.phpindex.html
在第67行修改:
User www
Group www
[[email protected] www]# cd
/application/apache/htdocs/www
[[email protected] www]#
echo “<?php phpinfo(); ?>” >test_info.php
[[email protected] www]#/application/apache/bin/apachectl -t
[[email protected] www]#
/application/apache/bin/apachectl graceful
http与mysql的结合
[[email protected] www]#vim /application/apache/htdocs/www/test_mysql.php
<?php
$link_id=mysql_connect('localhost','root','111111') or mysql_error();
if($link_id){
echo "MySQL successful by
abc !";
}
else {
echo mysql_error();
}
?>
[[email protected] www]#
mysqladmin -u root -p password 111111
安装
python
[[email protected] www]# cd
/tools/
[[email protected]]# tar xf Python-2.7.6.tgz
[[email protected]]# cd Python-2.7.6
[[email protected]]# ./configure --prefix=/application/python2.7.6
[[email protected]]# make && make install
[[email protected]]# mv /usr/bin/python /usr/bin/python2.6.6.old
[[email protected]]# ln -s /application/python2.7.6/bin/python /usr/bin/python
[[email protected]]# python -V
python setuptools install
[[email protected]]# cd /tools
[[email protected] tools]#
tar xf setuptools-12.0.3.tar.gz
[[email protected] tools]#
cd setuptools-12.0.3
[[email protected]]# python setup.py install
安装mysqldb
for python
[[email protected] tools]#
cd /tools
[[email protected] tools]#
unzip MySQLdb1-master.zip
[[email protected] tools]#
cd MySQLdb1-master/
[[email protected]]# which mysql_config
[[email protected]]# vim site.cfg
mysql_config =
/application/mysql/bin/mysql_config #将注释打开,修改后面which mysql_config
[[email protected]]# python setup.py build
[[email protected]]# python setup.py install
解压Lepus3.7软件检查各部分驱动是否正常连接
[[email protected] python]#cd /tools/
[[email protected] python]#
unzip Lepus数据库企业监控系统3.7版本官方下载.zip
[[email protected] python]#cd /tools/lepus_v3.7/python
[[email protected] python]#python test_driver_mysql.py
安装lepus采集器
[[email protected] python]#cd /tools/lepus_v3.7/python
[[email protected] python]#chmod +x lepus*
[[email protected] python]#chmod +x install.sh
[[email protected] python]#./install.sh
[[email protected] python]#cd /usr/local/lepus/
在监控机创建监控数据库并授权
[[email protected] lepus]#mysql -uroot -p111111
mysql> create
database lepus default character set utf8;
mysql> grant all on
lepus.* to ‘lepus_user’@‘localhost’ identified by ‘111111’;
mysql> flush
privileges;
导入SQL文件夹里的初始化SQL文件(表结构和数据文件)
[[email protected] lepus]#cd /tools/lepus_v3.7/sql/
[[email protected] sql]#mysql -uroot -p111111 lepus <lepus_table.sql
[[email protected] sql]#mysql -uroot -p111111 lepus <lepus_data.sql
修改lepus的数据库连接文件
[[email protected] sql]#cd /tools/lepus_v3.7
[[email protected] sql]#cp -rf php/* /application/apache/htdocs/www/
[[email protected]_v3.7]# vim /application/apache/htdocs/www/application/config/database.php
$db['default']['hostname']= '127.0.0.1';
$db['default']['port'] = '3306';
$db['default']['username']= 'lepus_user';
$db['default']['password']= '111111';
$db['default']['database']= 'lepus';
$db['default']['dbdriver'] = 'mysql';
修改配置文件
[[email protected]_v3.7]# vim /usr/local/lepus/etc/config.ini
[monitor_server]
host="127.0.0.1"
port=3306
user="lepus_user"
passwd="111111"
dbname="lepus"
重启服务器刷新配置
[[email protected] lepus]#
/application/apache/bin/apachectl –t
[[email protected] lepus]#
/application/apache/bin/apachectl graceful
启动lepus服务
[[email protected]_v3.7]# cd /usr/local/lepus/
[[email protected] lepus]#lepus start
[[email protected] lepus]#ps -ef|grep lepus
登录页面用户名admin密码Lepusadmin