全国职业院校技能大赛-云计算赛项_全国职业院校技能大赛linux云服务配置
一、LNMP环境搭建
1、centos7.9
自行准备linux环境,笔者使用的是centos7.9.2009查看版本命令为:cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)[root@blog ~]# setenforce 0[root@blog ~]# hostnamectl set-hostname blog[root@blog ~]# curl -O http://10.24.2.208/Application/wp-lnmp-c7.9.tar.gz[root@blog ~]# tar xf wp-lnmp-c7.9.tar.gz [root@blog ~]# rm -rf /etc/yum.repos.d/CentOS-*[root@blog ~]# cat /etc/yum.repos.d/local.repo[wordpress]name=wordpressbaseurl=file:///root/wp-lnmp-c7.9/packages/gpgcheck=0enabled=1[root@blog ~]# yum install -y unzip
2、nginx
[root@blog ~]# yum install -y nginx[root@blog ~]# vi /etc/nginx/nginx.conf.default location / { root html; index index.php index.html index.htm; } location ~ \\.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }[root@blog ~]# vi /etc/nginx/nginx.conf server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root html; index index.php index.html index.htm; #localtion 加入这个解析 } error_page 404 /404.html; location = /404.html { } location ~ \\.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; #加入php解析 include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
3、mariadb
[root@blog ~]# yum install -y mariadb mariadb-server[root@blog ~]# systemctl start mariadb [root@blog ~]# mysqladmin -uroot password \'123456\'[root@blog ~]# mysql -uroot -p123456 -e \"create database wordpress;\"[root@blog ~]# mysql -uroot -p123456MariaDB [(none)]> grant all on *.* to root@\'localhost\' identified by \'123456\';Query OK, 0 rows affected (0.000 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.001 sec)
4、php
[root@blog ~]# yum install -y php*[root@blog ~]# systemctl start php-fpm
5、wordpress
[root@blog ~]# unzip wp-lnmp-c7.9/wordpress-4.7.3-zh_CN.zip[root@blog ~]# rm -rf /usr/share/nginx/html/*[root@blog ~]# cp -rvf wordpress/* /usr/share/nginx/html/[root@blog ~]# systemctl restart nginx php-fpm[root@blog ~]# chown nginx:nginx /usr/share/nginx/html/[root@blog ~]# chown -R 755 /usr/share/nginx/html/
二、LAMP环境搭建
1、centos7.9
自行准备linux环境,笔者使用的是centos7.9.2009查看版本命令为:cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)[root@blog ~]# setenforce 0[root@blog ~]# hostnamectl set-hostname blog[root@blog ~]# curl -O http://10.24.2.208/Application/wp-lnmp-c7.9.tar.gz[root@blog ~]# tar xf wp-lnmp-c7.9.tar.gz [root@blog ~]# rm -rf /etc/yum.repos.d/CentOS-*[root@blog ~]# cat /etc/yum.repos.d/local.repo[wordpress]name=wordpressbaseurl=file:///root/wp-lnmp-c7.9/packages/gpgcheck=0enabled=1[root@blog ~]# yum install -y unzip
2、apache
[root@blog ~]# yum install -y httpd
3、mariadb
[root@blog ~]# yum install -y mariadb mariadb-server[root@blog ~]# systemctl start mariadb [root@blog ~]# mysqladmin -uroot password \'123456\'[root@blog ~]# mysql -uroot -p123456 -e \"create database wordpress;\"[root@blog ~]# mysql -uroot -p123456MariaDB [(none)]> grant all on *.* to root@\'localhost\' identified by \'123456\';Query OK, 0 rows affected (0.000 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.001 sec)
4、php
[root@blog ~]# yum install -y php*
5、wordpress
[root@blog ~]# unzip wp-lnmp-c7.9/wordpress-4.7.3-zh_CN.zip[root@blog ~]# rm -rf /var/www/html/*[root@blog ~]# cp -rvf wordpress/* /var/www/html/[root@blog ~]# chown apache:apache -R /var/www/html/[root@blog ~]# chown 755 -R /var/www/html/[root@blog ~]# systemctl start php-fpm httpd