1.1、安装MySQL
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum -y install mysql-server
1.2、修改MySQL的配置文件
vim /etc/my.cnf
[mysqld]
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
1.3、设置MySQL自动启动并启动MySQL(CENTOS 7):
# systemctl start mysqld
# systemctl enable mysqld
1.4、设置MySQL安全选项
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
1.5、创建Zabbix数据库
mysql -uroot -pkingdee
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.04 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
2、安装PHP
2.1、安装PHP
先安装第三方组件:
yum -y groupinstall "Development Tools"
yum install libxml2* -y
yum install curl curl-devel
yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64
yum install libjpeg-devel
wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar zxvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make install
再下载安装PHP 5.5.38:
wget http://php.net/distributions/php-5.5.38.tar.gz
tar zxvf php-5.5.38.tar.gz
./configure --prefix=/usr/local/php-5.5.38 --with-config-file-path=/usr/local/php-5.5.38/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
make
make install
Installing shared extensions: /usr/local/php-5.5.38/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP CLI binary: /usr/local/php-5.5.38/bin/
Installing PHP CLI man page: /usr/local/php-5.5.38/php/man/man1/
Installing PHP FPM binary: /usr/local/php-5.5.38/sbin/
Installing PHP FPM config: /usr/local/php-5.5.38/etc/
Installing PHP FPM man page: /usr/local/php-5.5.38/php/man/man8/
Installing PHP FPM status page: /usr/local/php-5.5.38/php/php/fpm/
Installing PHP CGI binary: /usr/local/php-5.5.38/bin/
Installing PHP CGI man page: /usr/local/php-5.5.38/php/man/man1/
Installing build environment: /usr/local/php-5.5.38/lib/php/build/
Installing header files: /usr/local/php-5.5.38/include/php/
Installing helper programs: /usr/local/php-5.5.38/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php-5.5.38/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php-5.5.38/lib/php/
[PEAR] Archive_Tar - installed: 1.4.0
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.3.0
[PEAR] PEAR - installed: 1.10.1
Wrote PEAR system config file at: /usr/local/php-5.5.38/etc/pear.conf
You may want to add: /usr/local/php-5.5.38/lib/php to your php.ini include_path
/root/php-5.5.38/build/shtool install -c ext/phar/phar.phar /usr/local/php-5.5.38/bin
ln -s -f phar.phar /usr/local/php-5.5.38/bin/phar
Installing PDO headers: /usr/local/php-5.5.38/include/php/ext/pdo/