写一个Web环境搭建教程,用于能够运行WordPress,这个Web服务器搭建教程使用云服务器搭建Web,我用阿里云服务器CentOS做个示例。
第一步:购买ECS服务器
这里比较简单,领券购买阿里云ECS服务器,选择CentOS系统即可,推荐CentOS 6.x 64位。
第二步:配置yum源
备份repo
mv /etc/yum.repos.d /etc/yum.repos.d.back mkdir /etc/yum.repos.d
新建CentOS源
vi /etc/yum.repos.d/CentOS-Base.repo
输入
# 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
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
vi /etc/yum.repos.d/MariaDB.repo
输入
# 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
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-pecl-imagick php-opcache mod_ssl sendmail unzip crontabs ghostscript MariaDB-server MariaDB-client
第四步:启动Apache、设置数据库密码
service httpd restart && service mysql restart mysql_secure_installation
第五步:Apache配置虚拟机
这里就不详细配置了,网上很多教程。
这样一个完整的Web云服务器搭建环境就可以运行WordPress了,再找一个合适的WordPress主题,愉快的玩耍自己的网站。