阿里云主机环境配置教程

2023年8月8日22:48:41阿里云主机环境配置教程已关闭评论
腾讯云正在大促:点击直达 阿里云超级红包:点击领取
免费/便宜/高性价比服务器汇总入口(已更新):点击这里了解

阿里云主机环境配置教程

分享一下阿里云主机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主题,愉快的玩耍自己的网站。

关于阿里云ECS云主机、GPU云主机和轻量应用主机配置和精准报价,请以官方页面为准:

1、阿里云ECS云主机报价页面:点击直达>>>

2、阿里云轻量应用主机活动页面:点击直达>>>

3、阿里云GPU云主机活动页面:点击直达>>>

4、阿里云云小站特惠活动页面:点击直达>>>

5、同配置云产品腾讯云相对便宜,点此进入腾讯云活动页面。还可以点此一键领取2860元无门槛满减券(老用户换QQ登陆,同一实名享新用户特价)。