web部署

1.部署过程

在华为云openEuler 安装后,没有配置yum源,我们通过重新配置。

cd /etc/yum.repos.d

vi openEuler_x86_64.repo

增加下面内容:

[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler

[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler

[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler

[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler

[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler

[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
 安装Apache:
 
yum install -y httpd
 
开启Apache服务
 
systemctl start httpd.service

Apache开机自启动:

systemctl enable httpd.service

禁止防火墙自启动:

systemctl disable firewalld

安装mariadb:

yum install -y mariadb-server

开启mariadb服务:

systemctl start mariadb

命令关闭防火墙:

systemctl stop firewalld

设置mariadb开机自启动:

systemctl enable mariadb

给mariadb数据库的root账户设置密码123456:

mysqladmin -uroot password '123456'

安装PHP和PHP模块:

yum install -y php

yum install -y php-mysqlnd php-fpm php-opcache php-cli php-curl php-dom php-exif php-fileinfo php-gd php-hash
php-json php-mbstring php-mysqli php-openssl php-pcre php-xml libsodium

安装交互更加良好的nano 文本编辑器:

yum install nano
 

查看Apache和mariadb的运行状态:

systemctl status httpd

 

 systemctl status mariadb

查看Apache和mariadb是否已经开启了开机自启动:

systemctl list-unit-files | grep httpd.service

systemctl list-unit-files | grep mariadb.service
 

查看PHP的版本信息:

php -v
 

创建一个PHP测试文件测试PHP是否正常,输出重定向到test.php文件:

echo "<?php phpinfo();  ?>" > /var/www/html/test.php
 

这个文件赋权限:

chmod 755 /var/www/h

重启Apache服务:

systemctl restart httpd

安装wget:

yum install -y wget

请求wordpress安装包(.ZIP):

wget https://cn.wordpress.org/latest-zh_CN.zip
 

查看mariadb的版本号:

rpm -qa | grep mariadb

登录到mariadb:

mysql -uroot -p

创建WordPress数据库:

create database wordpressdb;

安装unzip解压工具:

yum install -y unzip

unzip latest-zh_CN.zip -d /var/www
然后输入下面命令

 

 :访问ip/wp-config.php

 

 可能由于电脑原因,无法安装worldpress

2.遇到的问题

<1>httpd.conf的配置代码不对

<2>mariabd系统按ctrl+z可以退出

<3>php文件按ctrl+x退出

posted @ 2022-12-23 18:16  20221315杨烺  阅读(34)  评论(0编辑  收藏  举报