In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to install LAMP source code and how to build zabbix monitoring are believed to be at a loss for many inexperienced people. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
1. System environment check, version notes
1) release Notes
# httpd-2.4.25
# mysql-5.7.17-linux-glibc2.5-x86_64 binary compressed version
# php5.6.30
# zabbix-3.0.8
2) close selinux and iptables, and check the system version information
Sed-I's etc/selinux/config. SELINUXAfter enabledUnix SELINUXANGLEDUGER / etc/selinux/config
Getenforce 0
/ etc/init.d/iptables stop
Cat / etc/redhat-release
CentOS release 6.7 (Final)
Uname-r
2.6.32-431.el6.x86_64
Uname-m
X86_64
2. Install apache
Http://httpd.apache.org/download.cgi # apache official website
# create a new apache running user
Useradd-s / sbin/nologin-M www
Mkdir tools
Cd tools# downloads the http code package
Wget http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.25.tar.gz
Wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
Wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz
# attach the download address of aliyun
Wget-c http://mirrors.aliyun.com/apache/apr/apr-1.5.2.tar.gz
Wget-c http://mirrors.aliyun.com/apache/apr/apr-util-1.5.4.tar.gz
Wget-c http://mirrors.aliyun.com/apache/httpd/httpd-2.4.25.tar.gz
# install plug-ins apr and apr-util
# compile and install apr
Tar xf apr-1.5.2.tar.gz
Cd apr-1.5.2
. / configure-- prefix=/usr/local/apr-1.5.2
Make & & make install
Echo $?
Ln-s / usr/local/apr-1.5.2/ / usr/local/apr
Cd..
# compile and install apr-util
Tar xf apr-util-1.5.4.tar.gz
Cd apr-util-1.5.4
. / configure-prefix=/usr/local/apr-util-1.5.4-with-apr=/usr/local/apr-1.5.2/
Echo $?
Make & & make install
Echo $?
Ln-s / usr/local/apr-util-1.5.4/ / usr/local/apr-util
Cd.. # install the feature pack
Yum install pcre-devel zlib-devel openssl-devel-y
# install apache
Tar zxvf httpd-2.4.25.tar.gz
Cd httpd-2.4.25./configure-- prefix=/usr/local/httpd-2.4.25\
-- with-apr=/usr/local/apr-1.5.2\
-- with-apr-util=/usr/local/apr-util-1.5.4\
-enable-so-enable-deflate-enable-expires\
-enable-headers-enable-ssl-enable-rewrite\
-- enable-mpms-shared=all-- with-mpm=prefork\
-- enable-mods-shared=most
# compile and install
Make
Make install
Configuration parameters explain:
#-prefix= apache installation directory. By default, the installation directory is set to / usr/local/apache2.
#-sysconfdir= specifies the configuration file installation path
#-with-apr= if you want to use the installed APR, you must tell the script configure the apr installation path
#-with-apr-util specifies the installation path of the installed apr-util
#-enable-so allows DSO modules to be loaded at runtime
#-enable-cgi enables cgi protocol
#-with-zlib enables zlib library files
#-with-pcre specifies the installation path of pcre
#-enable-modules=most enables most shared modules
#-enable-deflate compressed transmission coding support
#-enable-expires Expires header control
#-enable-headers HTTP header control
#-enable-ssl enables ssl encryption, and SSL/TLS supports (mod_ssl)
#-enable-rewrite rule-based URL operation to enable URL rewriting
#-enable-mpms-shared=all space-separated MPM module list is enabled and loaded dynamically
#-with-mpm=prefork specifies the type of MPM used, and select the process model used by Apache (event | worker | prefork | winnt)
#-enable-mods-shared=most enables most of the parameters of MPM and defines the list of modules to be enabled and built as dynamic sharing modules. The default setting is most (all | most | few | reallyall)
# go to the version number and make a link
Ln-s / usr/local/httpd-2.4.25/ / usr/local/httpd
# configure http environment variables
Echo "export PATH=/usr/local/httpd/bin:$PATH" > > / etc/profile
. / etc/profile
# View http module
Ls / usr/local/httpd/modules
# View the installed modules
/ usr/local/httpd/bin/apachectl-l
/ usr/local/httpd/bin/apachectl-M
Apachectl-t-D DUMP_MODULES
# modify http configuration file
Sed-I 's/#ServerName www.example.com:80/ServerName localhost:80/g' / usr/local/httpd/conf/httpd.conf
# start the apache service
Apachectl start
# View http service
Netstat-lntup | grep httpd
Tcp 0 0: 80: * LISTEN 56389/httpd
# configure startup script
Cp / usr/local/httpd/bin/apachectl / etc/init.d/httpd
Chmod + x / etc/init.d/httpd
/ etc/init.d/httpd stop
Netstat-lntup | grep httpd
/ etc/init.d/httpd start
Netstat-lntup | grep httpd
Vim / etc/init.d/httpd
# add:
# chkconfig: 345 85 15
# description: this my apache is httpd server
# join the system startup service and boot automatically
Chkconfig-add httpd
Chkconfig httpd on
Chkconfig-list httpd
# Test access is normal! At this point the apache installation is complete!
# one-click installation of apache 2.4.25
Useradd-s / sbin/nologin-M wwwmkdir ~ / toolscd ~ / tools/bin/ping baidu.com-c 2 [$?-eq 0] & & {wget wget wget} | | exit 110tar xf apr-1.5.2.tar.gz cd apr-1.5.2./configure-- prefix=/usr/local/apr-1.5.2make & & make installecho $? [$?-eq 0] & & {ln-s / usr/local/apr-1.5.2/ / usr/local/aprcd..} # compile and install apr-utiltar xf apr-util-1.5.4.tar.gz cd apr-util-1.5.4./configure-- prefix=/usr/local/apr-util-1.5.4-- with-apr=/usr/local/apr-1.5.2/make & & make installecho $? sleep 2ln-s / usr/local/apr-util-1.5.4/ / usr/local/apr-utilcd.. yum install pcre- Devel zlib-devel openssl-devel-ytar zxvf httpd-2.4.25.tar.gz cd httpd-2.4.25./configure-- prefix=/usr/local/httpd-2.4.25\-- with-apr=/usr/local/apr-1.5.2\-- with-apr-util=/usr/local/apr-util-1.5.4\-- enable-so-- enable-deflate-- enable-expires\-enable-headers-- enable-ssl-- enable-rewrite\ -- enable-mpms-shared=all-- with-mpm=prefork\-- enable-mods-shared=mostecho $? sleep 2makemake installln-s / usr/local/httpd-2.4.25/ / usr/local/httpdecho "export PATH=/usr/local/httpd/bin:$PATH" > / etc/profile. / etc/profilesed-I 's/#ServerName www.example.com:80/ServerName localhost:80/g' / usr/local/httpd/conf/httpd.confapachectl startnetstat-lntup | grep 80 > / dev/null & & echo OK!
3. MySQL installation and configuration, here for binary installation
Useradd-s / sbin/nologin-M mysql
Wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
Tar-zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
Mv mysql-5.7.17-linux-glibc2.5-x86_64 / usr/local/mysql-5.7.17
Ln-s / usr/local/mysql-5.7.17 / usr/local/mysql
# create a database file directory
Mkdir-p / data/mysql
Chown-R mysql.mysql / data/
# configure the startup script file and join the system service for self-startup
Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld
Chmod + x / etc/init.d/mysqld
Chkconfig-add mysqld
Chkconfig mysqld on
# configure mysql configuration file
Cat > / etc/my.cnf > / etc/profile
. / etc/profile
# start the MySQL service
/ etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
Netstat-lntup | grep 3306
Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 28150/mysqld
Ps-ef | grep mysql
Root 28284 1 2 07:26 pts/0 00:00:00 / bin/sh / usr/local/mysql/bin/mysqld_safe-datadir=/data/mysql-pid-file=/data/mysql/mysql.pid
Mysql 29119 28284 5 07:26 pts/0 00:00:00 / usr/local/mysql/bin/mysqld-basedir=/usr/local/mysql-datadir=/data/mysql-plugin-dir=/usr/local/mysql/lib/plugin-user=mysql-log-error=/data/mysql/mysql-error.log-open-files-limit=65535 open-files-limit=65535 pid-file=/data/mysql/mysql.pid socket=/tmp/mysql.sock port=3306
# modify root password:
French 1:mysql-uroot-e "Set password=password ('123.com');"
French 2:mysql-uroot-p123.com-e "use mysql;update user set authentication_string=password ('456.com') where user='root';"
French 3:update mysql.user set authentication_string=password ("123.com") where user='root'
4. Installation and configuration of PHP
# check whether apache and MySQL start normally
Netstat-lntup | egrep'80 | 3306'
Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 29119/mysqld
Tcp 0 0: 80: * LISTEN 26925/httpd
1) extension support (mcrypt, mhash extensions, and libevent)
Mcrypt extension library can realize the function of encryption and decryption, that is, it can not only encrypt plaintext, but also restore ciphertext.
Mhash is an irreversible php encryption extension library based on discrete mathematics, which is not turned on by default.
Mhash can be used to create check values, message digests, message authentication codes, and save key information without the original text (such as passwords). Libevent is an asynchronous event notification library file whose API provides a mechanism to execute callback functions when an event occurs or times out on a file description
It is mainly used to replace the event loop mechanism on event-driven network servers.
Currently, libevent supports event ports for / dev/poll, kqueue, select, poll, epoll and Solaris.
The centos source cannot install libmcrypt-devel. There is no package with mcrypt due to copyright.
You can use third-party sources, so you can also use yum to install
Install a third-party yum source
Wget http://www.atomicorp.com/installers/atomic
Sh. / atomic
Install using the yum command
Yum install php-mcrypt libmcrypt libmcrypt-devel mhash mhash-devel libevent libevent-devel
2) related packages that support xml
Rpm packages that support xml
Bzip2 is a lossless compression software based on Burrows-Wheeler transform, which can compress file data efficiently.
The main function of libcurl is to connect and communicate with different servers using different protocols, that is, quite encapsulated sockPHP.
Libcurl allows you to connect and communicate with different servers using different protocols
Yum install libxml2 libxml2-devel bzip2-devel libcurl-devel
3) rpm packages related to graphics
Yum install libjpeg-devel libpng-devel freetype-devel
# batch installation can be copied, with some commonly used packages added in the middle to check whether it is installed, otherwise an error will be reported in later configuration
Wget http://www.atomicorp.com/installers/atomic
Sh. / atomic
Yum-y install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel gd-devel curl-devel openssl-devel libxslt-devel* php-mcrypt libmcrypt libmcrypt-devel mhash mhash-devel libevent libevent-devel libxml2 libxml2-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel
If there is a problem with yum installation, you can compile and install mcrypt, libmcrypt and mhash libraries:
Download address: wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gztar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configure-- prefix=/usr/local/libmcryptmake & & make installcd.. tar-zxvf mhash -0.9.9.9.tar.gzcd mhash-0.9.9.9./configuremake & & make installcd.. tar zxvf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8./configure-- with-libmcrypt-prefix=/usr/local/libmcrypt/make & & make installcd.. echo "/ usr/local/libmcrypt/lib" > > / etc/ld.so.conf.d/lib.confecho "/ usr/local/lib" > > / etc/ld.so.conf.d/ Lib.conf # configure additional library file paths That is, the library files installed above need to specify a path to reload ldconfig-v # reload library files Note: here the source code only installs library files that cannot be installed in domestic yum libraries, such as yum installation for missing package files in PHP configuration.
# install PHP
Wget http://219.238.7.71/files/1007000009B9E9D0/cn2.php.net/distributions/php-5.6.30.tar.gztar zxvf php-5.6.30.tar.gz
Cd php-5.6.30
. / configure\
-- prefix=/usr/local/php\
-- with-config-file-path=/usr/local/php/etc\
-- with-apxs2=/usr/local/httpd/bin/apxs\
-- enable-inline-optimization\
-- enable-fpm\
-- with-mysql=/usr/local/mysql\
-- with-mysqli=/usr/local/mysql/bin/mysql_config\
-- with-pdo-mysql=/usr/local/mysql\
-- with-gettext\
-- enable-mbstring\
-- with-iconv=/usr/local/libiconv\
-- with-mcrypt\
-- with-mhash\
-- with-openssl\
-- enable-bcmath\
-- enable-soap\
-- with-libxml-dir\
-- enable-sockets\
-- with-curl\
-- with-zlib\
-- enable-zip\
-- with-bz2\
-- with-gd\
-- with-freetype-dir\
-- with-jpeg-dir\
-- with-png-dir\
-- enable-ctype\
-- enable-xml
Echo $?
Make
Make install
Cp php.ini-production / usr/local/php/etc/php.ini
# check apache and PHP integration
Grep modules/libphp5.so / usr/local/httpd/conf/httpd.conf
Modify the apache configuration file:
Vim / usr/local/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
# add:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# modify users:
User www
Group www
# modify the home page file:
DirectoryIndex index.php index.html
# check the apache configuration file:
/ usr/local/httpd/bin/apachectl-t
Syntax OK
# write a test page to test whether the PHP is parsed properly
Vim / usr/local/apache/htdocs/index.php
# reload apache configuration file
/ usr/local/apache/bin/apachectl graceful
Test access is normal!
# write test code to test whether the database link is normal
Vim / usr/local/apache/htdocs/mysql-test.php
# at this point, LAMP installation is complete!
5. Zabbix installation and configuration
Wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.8/zabbix-3.0.8.tar.gz
# installation supports monitoring snmp packages, monitoring switches, etc.
Yum install net-snmp-devel
Tar zxvf zabbix-3.0.8.tar.gz
Cd zabbix-3.0.8
/ configure-- prefix=/usr/local/zabbix-- enable-server-- enable-agent-- with-mysql-- with-net-snmp-- with-libcurl-- with-libxml2
Make & & make install
Echo $?
# configure database to import data
Mysql > create database zabbix
Mysql > grant all on zabbix.* to 'zabbixuser'@'localhost' identified by' 123.com'
Query OK, 0 rows affected, 1 warning (0.00 sec)
Mysql > flush privileges
Query OK, 0 rows affected (0.01 sec)
Mysql > use zabbix
Mysql > source / root/tools/zabbix-3.0.8/database/mysql/schema.sql
Mysql > source / root/tools/zabbix-3.0.8/database/mysql/p_w_picpaths.sql
Mysql > source / root/tools/zabbix-3.0.8/database/mysql/data.sql
# initialization sql file is located in the source code package / root/zabbix-3.0.4/database/mysql directory
# modify the configuration zabbix_server configuration file as follows:
Vim / usr/local/zabbix/etc/zabbix_server.conf
LogFile=/usr/local/zabbix/logs/zabbix_server.log
DBHost=localhsot
DBName=zabbix
DBUser=zabbixuser
Password for DBPassword=123.com # zabbixuser
LogSlowQueries=3000
Cp misc/init.d/fedora/core/* / etc/init.d/
Chmod + x / etc/init.d/zabbix_server
Chmod + x / etc/init.d/zabbix_agentd
Sed-I's inverse Basesian IRR engine usr _ r _ r
Sed-I's inverse Basesian IRR engine usr _ r _ r
Useradd-s / sbin/nologin-M zabbix
Mkdir / usr/local/zabbix/logs
Chown-R zabbix.zabbix / usr/local/zabbix/
/ etc/init.d/zabbix_agentd start
/ etc/init.d/zabbix_server start
Netstat-lntup | grep 1005
Tcp 00 0.0.0.0 10050 0.0.0.015 * LISTEN 28005/zabbix_agentd
Tcp 00 0.0.0.0 10051 0.0.0.015 * LISTEN 27916/zabbix_server
# copy the code file to the apache release directory and change it to zabbix:
Cp-a frontends/php / usr/local/httpd/htdocs/zabbix
Sed-I's replacement date.timezone = # date.timezone = Asia/Shanghai#g' / usr/local/php/etc/php.ini
Sed-I 's#post_max_size = 8M#post_max_size = 16Macrog' / usr/local/php/etc/php.ini
Sed-I 's#max_execution_time = 30#max_execution_time = 300 millig' / usr/local/php/etc/php.ini
Sed-I 's#max_input_time = 60#max_input_time = 300 millig' / usr/local/php/etc/php.ini
# just get rid of the previous #, which has been entangled for a long time.
Sed-I / 1#always_populate_raw_post_data / usr/local/php/etc/php.ini
# reload apache
/ usr/local/httpd/bin/apachectl graceful
The last step (install) will report an error and the configuration file cannot be created.
Download the configuration file and save it to / usr/local/httpd/htdocs/zabbix/conf/zabbix.conf.php
Just log in again: usename:admin password:zabbix
Modify Chinese: administration > > users > > admin > > language (chinese (zh_CN)) to update the web page.
Solve the problem of Chinese garbled in the graphical interface:
Select a Chinese font such as "italics" from windows Control Panel-> Font->
Cd / usr/local/httpd/htdocs/zabbix/fonts
Mv DejaVuSans.ttf DejaVuSans.ttf.bak
Rz uploads font file simkai.ttf to the current directory
Ls
DejaVuSans.ttf.bak simkai.ttf
Vim.. / include/defines.inc.php
Use the replace feature in VIM editing to replace DejaVuSans with simkai without adding a suffix.
:% s/DejaVuSans/simkai
Question 1:
. / zabbix_server
. / zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
Resolve:
# find /-name "libmysqlclient.so.20"
/ usr/local/mysql-5.7.17/lib/libmysqlclient.so.20
Ln-s / usr/local/mysql/lib/libmysqlclient.so.20 / usr/lib
Ldconfig
After reading the above, have you mastered how to install LAMP source code and how to set up zabbix monitoring? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.