首页 > centOS7.4服务器 yum安装 搭建lamp环境

centOS7.4服务器 yum安装 搭建lamp环境

// 红色加粗是linux命令

安装gcc和gcc-c++
yum -y install gcc gcc-c++


yum list httpd*



安装apche
yum -y install httpd.x86_64 httpd-devel.x86_64 httpd-tools.x86_64
开启服务
/bin/systemctl start httpd.service
停止服务
/bin/systemctl stop httpd.service
设置Apache服务开机启动
systemctl enable httpd.service
默认目录:/var/www/html/
卸载
yum remove httpd




安装mysql
https://www.cnblogs.com/007sx/p/7083143.html
一、检查系统是否安装其他版本的MYSQL数据
yum list installed | grep mysql#yum -y remove mysql-libs.x86_64
二、安装及配置
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm# rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
安装MYSQL数据库
yum install mysql-community-server -y
设置为开机启动(2、3、4都是on代表开机自动启动)
chkconfig --list | grep mysqld# chkconfig mysqld on
三、设置远程root
启动mysql
service mysqld start
设置root密码
mysql_secure_installation
登陆root账号
mysql -uroot -p
建立远程root用户
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;mysql> flush privileges; 
四、设置utf-8编码
查看mysql原本编码:
mysql> show variables like 'character%';
mysql> q
设置编码
vim /etc/my.cnf
如下(少补):
[mysqld]character-set-server=utf8 collation-server=utf8_general_ci sql_mode='NO_ENGINE_SUBSTITUTION'
[mysql]default-character-set = utf8[mysql.server]default-character-set = utf8[mysqld_safe]default-character-set = utf8[client]default-character-set = utf8
重启mysql
service mysqld restart
再次查看编码:
mysql -uroot -p
mysql> show variables like 'character%';+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+| character_set_client | utf8 || character_set_connection | utf8 || character_set_database | utf8 || character_set_filesystem | binary || character_set_results | utf8 || character_set_server | utf8 || character_set_system | utf8 || character_sets_dir | /usr/share/mysql/charsets/ |+--------------------------+----------------------------+8 rows in set (0.00 sec)
mysql> q 




安装PHP https://www.cnblogs.com/pangguoming/p/6207970.html
1.检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
2 CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
 
如果想删除上面安装的包,重新安装
rpm -qa | grep webstatic
rpm -e  上面搜索到的包即可


3.运行yum install
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64


注:如果想升级到7.0把上面的56w换成70w就可以了。
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64


4.安装PHP FPM,以后需要可以单独安装插件
yum install php56w-fpm 
yum install php70w-fpm




djl补充安装的扩展
yum install php56w-xml.x86_64 php56w-xmlrpc.x86_64 php56w-devel.x86_64
yum install php56w-bcmath.x86_64 php56w-odbc.x86_64




安装php完成后,重启apache
/bin/systemctl restart httpd.service


//查看有哪些可以yum安装的扩展

yum list php56w*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* webtatic: uk.repo.webtatic.com
Installed Packages
php56w.x86_64 5.6.35-1.w7 @webtatic
php56w-cli.x86_64 5.6.35-1.w7 @webtatic
php56w-common.x86_64 5.6.35-1.w7 @webtatic
php56w-gd.x86_64 5.6.35-1.w7 @webtatic
php56w-ldap.x86_64 5.6.35-1.w7 @webtatic
php56w-mbstring.x86_64 5.6.35-1.w7 @webtatic
php56w-mcrypt.x86_64 5.6.35-1.w7 @webtatic
php56w-mysql.x86_64 5.6.35-1.w7 @webtatic
php56w-pdo.x86_64 5.6.35-1.w7 @webtatic
Available Packages
php56w-bcmath.x86_64 5.6.35-1.w7 webtatic
php56w-dba.x86_64 5.6.35-1.w7 webtatic
php56w-devel.x86_64 5.6.35-1.w7 webtatic
php56w-embedded.x86_64 5.6.35-1.w7 webtatic
php56w-enchant.x86_64 5.6.35-1.w7 webtatic
php56w-fpm.x86_64 5.6.35-1.w7 webtatic
php56w-imap.x86_64 5.6.35-1.w7 webtatic
php56w-interbase.x86_64 5.6.35-1.w7 webtatic
php56w-intl.x86_64 5.6.35-1.w7 webtatic
php56w-mssql.x86_64 5.6.35-1.w7 webtatic
php56w-mysqlnd.x86_64 5.6.35-1.w7 webtatic //安装报错
php56w-odbc.x86_64 5.6.35-1.w7 webtatic
php56w-opcache.x86_64 5.6.35-1.w7 webtatic
php56w-pear.noarch 1:1.10.4-1.w7 webtatic
php56w-pecl-apcu.x86_64 4.0.11-2.w7 webtatic
php56w-pecl-apcu-devel.x86_64 4.0.11-2.w7 webtatic
php56w-pecl-gearman.x86_64 1.1.2-1.w7 webtatic
php56w-pecl-geoip.x86_64 1.1.1-1.w7 webtatic
php56w-pecl-igbinary.x86_64 2.0.5-1.w7 webtatic
php56w-pecl-igbinary-devel.x86_64 2.0.5-1.w7 webtatic
php56w-pecl-imagick.x86_64 3.4.3-1.w7 webtatic
php56w-pecl-imagick-devel.x86_64 3.4.3-1.w7 webtatic
php56w-pecl-libsodium.x86_64 1.0.6-1.w7 webtatic
php56w-pecl-memcache.x86_64 3.0.8-2.w7 webtatic
php56w-pecl-memcached.x86_64 2.2.0-1.w7 webtatic
php56w-pecl-mongodb.x86_64 1.4.1-1.w7 webtatic
php56w-pecl-redis.x86_64 3.1.6-1.w7 webtatic
php56w-pecl-xdebug.x86_64 2.5.5-2.w7 webtatic
php56w-pgsql.x86_64 5.6.35-1.w7 webtatic
php56w-phpdbg.x86_64 5.6.35-1.w7 webtatic
php56w-process.x86_64 5.6.35-1.w7 webtatic
php56w-pspell.x86_64 5.6.35-1.w7 webtatic
php56w-recode.x86_64 5.6.35-1.w7 webtatic
php56w-snmp.x86_64 5.6.35-1.w7 webtatic
php56w-soap.x86_64 5.6.35-1.w7 webtatic
php56w-tidy.x86_64 5.6.35-1.w7 webtatic
php56w-xml.x86_64 5.6.35-1.w7 webtatic
php56w-xmlrpc.x86_64 5.6.35-1.w7 webtatic


转载于:https://www.cnblogs.com/idjl/p/9610556.html

更多相关:

  • 一、软件包分类 1.软件包分类:源码包、二进制包 源码包:源代码 1)优点:开源,有能力可修改源代码 可以自由选择所需的功能 软件是编译安装,更适合Linux系统,更稳定效率更高 卸载方便。2)缺点:安装过程步骤多,编译时间较长,安装过程中一旦报错新手很难解决。 二进制包:源码包经过编译之后生成的二进制程序(0101000...

  • 搭建企业内部yum仓库(centos6+centos7+epel源) 原文:https://www.cnblogs.com/nulige/p/6081192.html https://www.linuxidc.com/Linux/2017-11/148723.htm---------部署yum仓库与定制rpm包 1. 创建yum...

  • 行业公认标准 rpm的常用参数     i: 安装应用程序(install)     e: 卸载应用程序(erase)     vh: 显示安装进度:(verbose hash)     U: 升级软件包;(update)     qa: 显示所有已安装软件包(query all)     结合grep命令使用 例子:rmp -ivh...

  • 2019独角兽企业重金招聘Python工程师标准>>> 1、基本操作a) 列出package# yum listb) 搜索package# yum search or# yum list | grep c) 查看package信息# yum info

  • 1.yum管理rpm包   为rpm的前端程序 /var/ftp/pub/Server/repodata/ rpm -qf 'which yum' 查看yum的提供包 yum list |wc -l yum install yum remove yum update yum updateprovid 包名 yum clean all...