CentOS
Nginx
先决条件
yum -y install yum-utils
设置存储库
cat>/etc/yum.repos.d/nginx.repo<<\EOF
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF
安装
yum -y install nginx
yum -y install nginx-all-modules
配置
启动
chkconfig nginx on
service nginx start
Mysql
设置存储库
yum -y install https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
yum-config-manager --enable mysql57-community
yum-config-manager --disable mysql80-community
安装
yum -y install mysql-community-server
配置
grep -o 'password .*' /var/log/mysqld.log |awk '{print $6}'
mysql -uroot -p
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
#允许外网访问
update user set host='%' where user='root';
#mysql5.7及以下 授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyNewPass4!' WITH GRANT OPTION;
flush privileges;
exit
#mysql8.0及以上 授权
SET GLOBAL VALIDATE_PASSWORD.POLICY=0;
CREATE USER 'root'@'10.201.7.%' IDENTIFIED BY 'ABcd1234!@#$';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
启动
service mysqld start
PHP
添加remi源
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php56
yum-config-manager --disable remi-php54
安装
yum -y install php php-fpm
yum -y install php-bcmath php-gd php-markdown php-mbstring php-mcrypt php-mysqlnd php-opcache php-process php-soap php-xml php-xmlrpc
配置
启动
chkconfig php-fpm on
service php-fpm start
Debian
PHP
Prerequisites
Follow the below command to install the required packages first on your system. Then import packages signing key. After that configure PPA for the PHP packages on your system.
$ sudo apt install ca-certificates apt-transport-https
$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
$ sudo echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
Now follow the below options to install PHP.
Install PHP 5.6
Follow the below command to install the PHP 5.6 on your Debian 9 stretch system.
$ sudo apt update
$ sudo apt install php5.6
You can also install required PHP modules using below command.
$ sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-gd php5.6-json php5.6-mbstring php5.6-mysql php5.6-xml
Install PHP 7.2
Follow the below command to install PHP 7.2 on your Debian 9 stretch system
$ sudo apt update
$ sudo apt install php7.2
You can also install required PHP modules using below comman
$ sudo apt install php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-xml
Install PHP 7.1
If you application has specific requirement of PHP 7.1, You can yuse the following commands for installing PHP 7.1 on your Debian 9 Stretch system.
$ sudo apt update
$ sudo apt install php7.1
You can also install required PHP modules using below command.
$ sudo apt install php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-xml
此处评论已关闭