PHP
https://www.daehub.com/archives/2254.html
为了能够安装PHP7,需要安装EPEL 和Remi 的软件源,执行如下命令安装:
1 2 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
现在需要安装yum-utils 工具,这个一个yum工具的增强工具,可以更加方便的管理yum软件源:
yum-utils的提供了一个yum-config-manager程序,它可以将Remi 软件包作为默认源来安装PHP7:
1 yum-config-manager --enable remi-php70 [安装 PHP 7.0]
如果想在CentOS 7系统中安装PHP 7.1或PHP 7.2,则使用如下命令:
1 2 yum-config-manager --enable remi-php71 [安装 PHP 7.1] yum-config-manager --enable remi-php72 [安装 PHP 7.2]
最后,使用如下命令将PHP及常的扩展安装至系统:
1 yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-devel php-mbstring php-simplexml php-dom php-common php-fpm
最后,可以使用php -v命令来检查PHP是否正确的安装至CentOS 7系统中。
Nginx https://qizhanming.com/blog/2018/08/06/how-to-install-nginx-on-centos-7
添加 yum 源 Nginx 不在默认的 yum 源中,可以使用 epel 或者官网的 yum 源,本例使用官网的 yum 源。
1 sudo rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装完 yum 源之后,可以查看一下。
1 2 3 4 5 6 7 8 9 10 11 12 sudo yum repolist Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com repo id repo name status base/7/x86_64 CentOS-7 - Base 9,911 extras/7/x86_64 CentOS-7 - Extras 368 nginx/x86_64 nginx repo 108 updates/7/x86_64 CentOS-7 - Updates 1,041 repolist: 11,428
可以发现 nginx repo
已经安装到本机了。
安装 yum 安装 Nginx,非常简单,一条命令。
1 $ sudo yum install nginx
配置 Nginx 服务 设置开机启动 1 $ sudo systemctl enable nginx
启动服务 1 $ sudo systemctl start nginx
停止服务 1 $ sudo systemctl restart nginx
重新加载,因为一般重新配置之后,不希望重启服务,这时可以使用重新加载。
1 $ sudo systemctl reload nginx
Mysql https://juejin.im/post/5c088b066fb9a049d4419985
添加Mysql5.7仓库 1 sudo rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
确认Mysql仓库成功添加 1 sudo yum repolist all | grep mysql | grep enabled
如果展示像下面,则表示成功添加仓库:
1 2 3 mysql-connectors-community/x86_64 MySQL Connectors Community enabled: 51 mysql-tools-community/x86_64 MySQL Tools Community enabled: 63 mysql57-community/x86_64 MySQL 5.7 Community Server enabled: 267
开始安装Mysql5.7 1 sudo yum -y install mysql-community-server
启动Mysql 启动 1 sudo systemctl start mysqld
设置系统启动时自动启动 1 sudo systemctl enable mysqld
查看启动状态 1 sudo systemctl status mysqld
Mysql的安全设置 CentOS上的root默认密码可以在文件/var/log/mysqld.log找到,通过下面命令可以打印出来
1 cat /var/log/mysqld.log | grep -i 'temporary password'
执行下面命令进行安全设置,这个命令会进行设置root密码设置,移除匿名用户,禁止root用户远程连接等
1 mysql_secure_installation (Prod@Mysql@Passw0rd)
设置数据库编码为utf8
打开配置文件
1 2 sudo vim /etc/my.cnf 复制代码
在[mysqld],[client],[mysql]节点下添加编码设置
1 2 3 4 5 6 7 8 9 10 11 [client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8 复制代码
重启Mysql即可
1 sudo systemctl restart mysqld
Git 安装
查看版本 1 2 git --version git version 1.8.3.1
Redis https://www.linode.com/docs/databases/redis/install-and-configure-redis-on-centos-7/
安装启动
Add the EPEL repository, and update YUM to confirm your change:
1 2 sudo yum install epel-release sudo yum update
Install Redis:
Start Redis:
1 sudo systemctl start redis
Optional : To automatically start Redis on boot:
1 sudo systemctl enable redis
验证 Verify that Redis is running with redis-cli
:
If Redis is running, it will return:
Composer 安装 1 2 curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
验证 1 2 composer -V Composer version 1.9.1 2019-11-01 17:20:17
设置镜像地址 1 composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/