yum update
yum -y install gcc automake autoconf libtool make
yum install gcc gcc-c++
yum install pcre pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel
http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar -xzf nginx-1.16.1.tar.gz
cd nginx-1.16.1
./configure
make && make install
cd /usr/local/nginx/sbin
./nginx //启动nginx服务
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
wget https://www.php.net/distributions/php-7.4.3.tar.gz
cd php-7.4.3
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --without-pear --disable-phar --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
rm -rf /etc/php.ini
ln -s /usr/local/php/etc/php.ini /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid //去除前面的分号
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf #拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
service php-fpm start #启动php-fpm
vi /usr/local/nginx/conf/nginx.conf #配置nginx支持php
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
cd /usr/local/nginx/sbin
./nginx -s reload #重新加载nginx的配置文件
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
(1)rpm -ivh mysql-community-common-8.0.19-1.el7.x86_64.rpm
(2)rpm -ivh mysql-community-libs-8.0.19-1.el7.x86_64.rpm
(3)rpm -ivh mysql-community-client-8.0.19-1.el7.x86_64.rpm
(4)rpm -ivh mysql-community-server-8.0.19-1.el7.x86_64.rpm
(5)rpm -ivh mysql-community-devel-8.0.19-1.el7.x86_64.rpm
#若出现
#warning: mysql-community-common-8.0.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
#在后面添加--force --nodeps
mkdir -p /data/www #创建数据库数据保存目录
useradd mysql -s /sbin/nologin #创建用户mysql,不允许用户直接登录系统
mkdir -p /var/mysql/data #创建MySQL数据库存数据存放目录
chown -R mysql:mysql / var/mysql/data #设置MySQL数据库目录权限
vi /etc/my.cnf #编辑配置文件
datadir = /var/mysql/data
mysqld --initialize --user=mysql #生成mysql系统数据库
cat /var/log/mysqlld.log #查看root的追随初始密码
jv0E:r;5rB/Z
systemctl start mysqld #启动mysql服务
systemctl status mysqld #查看是否开启mysql服务(running)
mysql -uroot -p #打开数据库
alter user 'root'@'localhost' identified by '134679'; #修改密码
show databases; #显示数据库