首页 文章 详情

linux nginx mysql php yum安装

nginx 安装

先安装nginx的yum源

http://nginx.org/en/linux_packages.html#stable 找到链接,安装:
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

查看:

yum info nginx

安装:

yum install nginx

安装完成后nginx就已经启动了,可以查看进程:

启动nginx:

service nginx start

**据运维同学反馈,通过yum源安装之后,在安装插件时会有所限制。但针对目前学习,已经足够了。

PHP 安装

这两天又装了一下虚拟机,又要编译lnmp,还要弄各种拓展,很麻烦,能不能直接yum安装呢?答案是可以的!

1、首先安装 EPEL 源:

yum install epel-release安装 REMI 源:

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm2、安装 Yum 源管理工具:

yum install yum-utils

3、安装 PHP7.3:

yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll

安装完成后最好重启一下计算机,不然有可能无法启动php

设置开机启动、运行服务:

systemctl enable php73-php-fpm
systemctl start php73-php-fpm

4、检验一下成果:
查看一下php版本:

php -v

查看一下php拓展:

php -m

看到了吧?基本上会用的拓展都齐了吧?要啥自己去yum一下就好了!再也不用去纠结各种依赖问题了!

使用国内yum源:http://blog.csdn.net/zhezhebie/article/details/73484695
安装redis和memcached,直接yum安装即可:

yum install -y memcached redis
systemctl start php-fpm

Mysql 安装

安装mysql,并设置mysql开机自启动,同时启动mysql

先安装带有当前可用的mysql5系列社区版资源的rpm包。
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

这时查看当前可用的mysql安装资源:
yum repolist enabled | grep "mysql.*-community.*"

从上面的列表可以看出,mysql56-community/x86_64和MySQL 5.6 Community Server可以使用。
因此,我们就可以直接用yum方式安装了MySQL5.6版本了。
yum -y install mysql-community-server

安装完MySQL后,需要进行一些基础配置工作:
#######安装成功后,将其加入开机启动
[root@typecodes ~]# systemctl enable mysqld

#######启动mysql服务进程
[root@typecodes ~]# systemctl start mysqld

#######配置mysql(设置密码等)
[root@typecodes ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y [设置root用户密码]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y [删除匿名用户]
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y [禁止root远程登录]
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y [删除test数据库]
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y [刷新权限]
... Success!

 


All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

© 2020-现在 chifox.cn 东莞市创狐软件科技有限公司保留所有权利 粤ICP备2021012908号
0.012194s