寫一個Web環境搭建教程,用于能夠運行WordPress,這個Web服務器搭建教程使用云服務器搭建Web,我用阿里云服務器CentOS做個示例。
第一步:購買ECS服務器
這里比較簡單,先領取一下阿里云代金券,購買阿里云服務器ECS,選擇CentOS系統即可,推薦CentOS 6.x 64位。
第二步:配置yum源
備份repo
1
2
|
mv /etc/yum .repos.d /etc/yum .repos.d.back mkdir /etc/yum .repos.d |
新建CentOS源
1
|
vi /etc/yum .repos.d /CentOS-Base .repo |
輸入
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client.? You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base baseurl=https: //mirrors .tuna.tsinghua.edu.cn /centos/ $releasever /os/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates baseurl=https: //mirrors .tuna.tsinghua.edu.cn /centos/ $releasever /updates/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=https: //mirrors .tuna.tsinghua.edu.cn /centos/ $releasever /extras/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=https: //mirrors .tuna.tsinghua.edu.cn /centos/ $releasever /centosplus/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib baseurl=https: //mirrors .tuna.tsinghua.edu.cn /centos/ $releasever /contrib/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 |
新增epel、remi、MariaDB
1
2
3
|
yum install yum-utils -y yum install https: //mirrors .tuna.tsinghua.edu.cn /epel/6/x86_64/epel-release-6-8 .noarch.rpm yum install https: //mirrors .tuna.tsinghua.edu.cn /remi/enterprise/remi-release-6 .rpm |
1
|
vi /etc/yum .repos.d /MariaDB .repo |
輸入
1
2
3
4
5
6
7
|
# MariaDB 10.3 CentOS repository list - created 2019-01-10 05:49 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = https: //mirrors .tuna.tsinghua.edu.cn /mariadb/yum/10 .3 /centos6-amd64/ gpgkey=https: //mirrors .tuna.tsinghua.edu.cn /mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1 |
第三步:安裝Apache、PHP、MariaDB
1
2
3
|
yum makecache yum-config-manager -- enable remi remi-php73 yum install php php-bcmath php-cli php-common php-dba php-devel php-embedded php-enchant php-fpm php-gd php-intl php-ldap php-mbstring php-mysql php-mysqlnd php-odbc php-pdo php-pear php-pecl-memcache php-pgsql php-process php-pspell php-recode php-snmp php-soap php-xml php-xmlrpc php-opcache mod_ssl sendmail unzip crontabs MariaDB-server MariaDB-client |
第四步:啟動Apache、設置數據庫密碼
1
2
|
service httpd restart && service mysql restart mysql_secure_installation |
第五步:Apache配置虛擬機
這里就不詳細配置了,網上很多教程。
這樣一個完整的Web云服務器搭建環境就可以運行WordPress了,再找一個合適的WordPress主題,愉快的玩耍自己的網站。
上一篇: 阿里云服務器租賃報價與購買流程