centos7用yum搭建LAMP环境
用yum快速搭建LAMP平台
实验环境:
[root@nmserver- html]# cat /etc/redhat-release
CentOS release 7.3. (AltArch)
[root@nmserver- html]# uname -a
Linux nmserver-.test.com 3.10.-.el7.centos.plus.i686 # SMP Wed Jan :: UTC i686 i686 i386 GNU/Linux
1、安装apache
1.1 安装apache
[root@nmserver- ~]# yum install httpd httpd-devel
1.2 启动apache服务
[root@nmserver- ~]# systemctl start httpd
1.3 设置httpd服务开机启动
[root@nmserver- ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
1.4 查看服务状态
[root@nmserver- ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since 五 -- :: CST; 6min ago
Docs: man:httpd()
man:apachectl()
Main PID: (httpd)
Status: "Total requests: 11; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
├─ /usr/sbin/httpd -DFOREGROUND
└─ /usr/sbin/httpd -DFOREGROUND 7月 :: nmserver-.test.com systemd[]: Starting The Apache HTTP Server...
7月 :: nmserver-.test.com httpd[]: AH00558: httpd: Could not reliably determine the server's fully q...ssage
7月 :: nmserver-.test.com systemd[]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
1.5 防火墙设置开启80端口
[root@nmserver- ~]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@nmserver- ~]# firewall-cmd --permanent --zone=public --add-service=https
success
[root@nmserver- ~]# firewall-cmd --reload
success
1.6确认80端口监听中
[root@nmserver- ~]# netstat -tulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0:ssh 0.0.0.0:* LISTEN /sshd
tcp localhost:smtp 0.0.0.0:* LISTEN /master
tcp6 [::]:ssh [::]:* LISTEN /sshd
tcp6 localhost:smtp [::]:* LISTEN /master
tcp6 [::]:http [::]:* LISTEN /httpd
udp localhost: 0.0.0.0:* /chronyd
udp6 localhost: [::]:* /chronyd
1.8 查服务器IP
[root@nmserver- ~]# ip addr
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN qlen
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP qlen
link/ether :0c:::bc:cf brd ff:ff:ff:ff:ff:ff
inet 192.168.8.9/ brd 192.168.8.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe56:bccf/ scope link
valid_lft forever preferred_lft forever
: bridge0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu qdisc noqueue state DOWN qlen
link/ether ea::d5:c7:: brd ff:ff:ff:ff:ff:ff
1.9 浏览器登陆
2、安装mysql
2.1安装mysql
[root@nmserver- ~]# yum install mariadb mariadb-server mariadb-libs mariadb-devel
root@nmserver- ~]# rpm -qa |grep maria
mariadb-libs-5.5.-.el7.i686
mariadb-5.5.-.el7.i686
mariadb-server-5.5.-.el7.i686
mariadb-devel-5.5.-.el7.i686
2.2 开启mysql服务,并设置开机启动,检查mysql状态
[root@nmserver- ~]# systemctl start mariadb
[root@nmserver- ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@nmserver- ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since 六 -- :: CST; 21s ago
Main PID: (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─ /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─ /usr/libexec/mysqld --basedir=/usr --datadir=/v... 7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mariadb-prepare-db-dir[]: ...
7月 :: nmserver-.test.com mysqld_safe[]: ...
7月 :: nmserver-.test.com mysqld_safe[]: ...
7月 :: nmserver-.test.com systemd[]: Started MariaDB ...
[root@nmserver- ~]# netstat -tulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0:ssh 0.0.0.0:* LISTEN /sshd
tcp 0 0 0.0.0.0:mysql 0.0.0.0:* LISTEN 9760/mysqld
tcp6 [::]:ssh [::]:* LISTEN /sshd
tcp6 [::]:http [::]:* LISTEN /httpd
udp localhost: 0.0.0.0:* /chronyd
udp6 localhost: [::]:* /chronyd
2.3 数据库安全设置
[root@nmserver- ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, 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 MariaDB
root user without the proper authorisation. Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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] n
... skipping. By default, MariaDB 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
- Dropping test database...
... Success!
- 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! Cleaning up... All done! If you've completed all of the above steps, your MariaDB
installation should now be secure. Thanks for using MariaDB!
2.4 登陆数据库测试
[root@nmserver- ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is
Server version: 5.5.-MariaDB MariaDB Server Copyright (c) , , Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
rows in set (0.02 sec) MariaDB [(none)]>
3、安装PHP
3.1 安装php
[root@nmserver- ~]# yum -y install php
[root@nmserver- ~]# rpm -ql php
/etc/httpd/conf.d/php.conf
/etc/httpd/conf.modules.d/-php.conf
/usr/lib/httpd/modules/libphp5.so
/usr/share/httpd/icons/php.gif
/var/lib/php/session
3.2 将php与mysql关联起来
[root@nmserver- ~]# yum install php-mysql
[root@nmserver- ~]# rpm -ql php-mysql
/etc/php.d/mysql.ini
/etc/php.d/mysqli.ini
/etc/php.d/pdo_mysql.ini
/usr/lib/php/modules/mysql.so
/usr/lib/php/modules/mysqli.so
/usr/lib/php/modules/pdo_mysql.so
3.3 安装常用PHP模块
[root@nmserver- ~]# yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath
3.4 测试PHP
[root@nmserver-7 ~]# cd /var/www/html/
[root@nmserver-7 html]# ls
[root@nmserver-7 html]# pwd
/var/www/html
[root@nmserver-7 html]# vi info.php <?php
phpinfo();
?>
~
~
~
~
~
~
~
~
:wq
3.5重启apache服务器
[root@nmserver- html]# systemctl restart http
3.6测试PHP
在自己电脑浏览器输入 192.168.8.9/info.php,你可以看到已经安装的模块;
至此,CentOS7下LAMP环境搭建好了!下一步可以安装zabbix了!
centos7用yum搭建LAMP环境的更多相关文章
- 利用yum搭建lamp环境并进一步创建博客
用yum搭建lamp环境 第一.安装apache yum -y install httpd 第二.安装mariadb Yum -y mariadb mariadb-server 第三.安装php Yu ...
- 基于CentOS7的服务器搭建(LAMP环境)
基于CentOS7的服务器环境搭建(LAMP环境) 一.安装MySQL组件 1.由于在CentOS7中,默认yum安装库中不含有mysql,我们可以下载mysql的分支MariaDB,如果必须要下my ...
- CentOS 6.6 yum 搭建LAMP环境
CentOS 查看操作系统版本 [root@oa ~]# cat /etc/redhat-releaseCentOS release 6.6 (Final) 参考linux centos yum安装L ...
- yum搭建 Lamp环境
yum搭建Lamp yum install -y httpd yum install -y nano rpm 安装 Php7 相应的 yum源 rpm -Uvh https://dl.fedorapr ...
- centos7.2 yum安装lamp环境
一.准备工作 1. 下载并安装centos7.2,配置好网络环境,确保centos能上网,可以获取到yum源. centos7.2的下载地址:http://pan.baidu.com/s/1eRT ...
- centos7 yum搭建lamp环境
=============================================== 2018/1/14_第1次修改 ccb_warlock == ...
- yum搭建LAMP环境
LAMP=Linux+Apache(httpd)+Mysql(mariadb)+PHP Apache HTTP 服务器 2.4 文档:http://httpd.apache.org/docs/2.4/ ...
- centos7中yum安装lamp环境
一.准备工作 1.1 环境 操作系统:centos7(CentOS-7-x86_64-Minimal-1708) 硬件:(这个根据项目运行和配置建议设置,一般我先配个1核1G) 1.2 关闭selin ...
- Centos7+Apache2.4+php5.6+mysql5.5搭建Lamp环境——为了wordPress
最近想搭建个人博客玩玩,挑来挑去发现口碑不错的博客程序是wordpress,简称wp.虽然是学java路线的程序员,但因入行时间太短,至今没有发现较为称手开源的博客程序,如果各位大神有好的推荐,也希望 ...
随机推荐
- refinedet网络结构
refinedet只预测4个层,并且只有conv6_1.conv6_2,没有ssd中的conv7.8.9 refinedet的4个层都只有1个aspect ratio和1个min_size,所以每层每 ...
- ubuntu 网桥配置
vim /etc/network/interfaces auto lo iface lo inet loopback auto eth0 auto eth2 auto eth3 iface eth0 ...
- 简单使用Idea创建三层架构项目和数据库连接(使用原生ajax进行访问+ajax)
Idea创建三层架构项目 首先创建一个Web项目model 创建Web完成后进行创建entity.dao.service 特别注意 根据上面的步骤进行创建即可得到 创建完成 我们首先创建数据库 cre ...
- vuex+vue-router拦截
干就完了 项目中经常遇到这样一个场景,用户信息或者进行增删改的一些模块,需要根据用户是否登录,进行路由拦截,直接上代码 在store文件夹下的store.js中存放一个默认登录状态 /* * stor ...
- SpringBoot非官方教程 | 第五篇:springboot整合 beatlsql
转载请标明出处: 原文首发于:https://www.fangzhipeng.com/springboot/2017/07/11/springboot5-beatlsql/ 本文出自方志朋的博客 Be ...
- NEC 工程师规范
工程师规范 - 开发准备 了解产品和设计 参加需求.交互.视觉会议,了解产品设计和项目成员. 了解产品面向的设备和平台. 了解产品对兼容性的要求以及是否采用响应式设计等. 了解产品要使用的技术(WEB ...
- JS基础——浅谈前端页面渲染和性能优化
加载html中的静态资源 其中,加载静态资源的过程,一般为浏览器根据DNS服务器得到域名的IP地址,然后向这个IP的机器发送http请求,服务器收到.处理并返回http请求,浏览器得到返回http请求 ...
- web开发学习路线
第一阶段: HTML+CSS: HTML进阶.CSS进阶.div+css布局.HTML+css整站开发. JavaScript基础: Js基础教程.js内置对象常用方法.常见DOM树操作大全.ECMA ...
- 发送post请求几种常见content-type类型
application/x-www-form-urlencoded 这应该是最常见的 POST 提交数据的方式了.浏览器的原生 form 表单,如果不设置 enctype 属性,那么最终就会以 app ...
- grafana使用json数据源监控数据
功能实现完后有部分数据一直在波动,就产生了想把这个数据波动集成到grafana形成可视化界面的监控,但grafana不支持mongo数据库又懒得去用其他工具转换,特意看了下grafana的databa ...