腾讯云 CentOS73 初始镜像上安装 LAMP/LNMP


  • 更新主机名: # hostnamectl set-hostname newname
  • 首先更新所有现有系统包:yum update -y ; reboot
  • 安装 Apache # yum -y install httpd mod_ssl ; systemctl enable httpd; systemctl start httpd
  • 安装 MariaDB # yum -y install mariadb-server; systemctl enable mariadb; systemctl start mariadb; mysql_secure_installation
  • 安装 PHP7.2
  1. 安装 EPEL 源:# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  2. 安装 REMI 源:# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  3. # yum -y install yum-utils
  4. # yum-config-manager –enable remi-php72
  5. # yum -y install php72-php php72-php-mysqlnd php72-php-xml php72-php-mbstring php72-php-gd php72-php-mcrypt
  6. # ln -s /opt/remi/php72/root/bin/php /usr/bin
    或者建议去 /etc/bashrc 文件添加如下行:
    [ -f /opt/remi/php72/enable ] && . /opt/remi/php72/enable

安装其他工具:
# yum -y install python36-pip gcc python36-devel openssl-devel
新的 pip 和 python 都安装到了 /usr/local/bin , 包括 certbot

# export PATH=$PATH:/usr/local/bin

安装 Certbot: # yum install augeas augeas-devel libffi-devel python-devel; pip3 install –upgrade pip; pip3 install certbot certbot-apache

安装 git: # yum install git

再后记,LNMP 里的 Nginx 安装其实也非常简单:
1. yum -y install nginx; systemctl enable nginx; systemctl start nginx
2. yum -y install php72-php-fpm; systemctl enable php72-php-fpm; systemctl start php72-php-fpm

题外话:如果是用 CentOS7 Minimal 安装的话,可以考虑安装如下常用的包:
yum install psmisc net-tools tree telnet mlocate vim

作者: 甬洁网络

--移动互联网&物联网技术提供商