52、基于模块化方式安装LAMP
1、安装准备
firewall-cmd --state
systemctl stop firewalld
firewall-cmd --state
systemctl disable firewalld
vim /etc/selinux/config
SELINUX=disabled
setenforce 0
2、安装httpd-2.4.37
2.1安装依赖包
yum -y install pcre-devel expat-devel openssl-devel
yum -y groupinstall "Development tools" "Server Platform Development"
2.2、安装arp、arp-util
tar xf apr-2.6.5.tar.gz
cd apr-2.6.5
./configure --prefix=/usr/local/apr
make && make install
tar xf apr-util-2.6.2.tar.gz
cd apr-util-2.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install
2.3、安装httpd
tar xf httpd-2.4.37.tar.gz
cd httpd-2.4.37
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event
make && make install
2.4、测试
/usr/local/apache/bin/apachectl start
netstat -tuanlp | grep 80
/usr/local/apache/bin/apachectl stop
netstat -tuanlp | grep 80
2.5、服务器启动脚本
cat /etc/init.d/httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac
exit $RETVAL
chmod +x /etc/init.d/httpd
2.6、修改配置文件
cat /etc/httpd24/httpd.conf | grep ^PidFile
PidFile "/var/run/httpd.pid"
2.7、设置环境变量
vim /etc/profile.d/httpd.sh
export PATH=/usr/local/apache/bin:$PATH
source /etc/profile.d/httpd.sh
2.8、设置开机启动
chkconfig --add httpd
chkconfig httpd on
chkconfig --list httpd
2.9、启动服务
/etc/init.d/httpd start
netstat -tuanlp | grep 80
3、安装mysql-5.7.24
3.1、卸载系统自带Mariadb
find / -name mariadb*
yum -y remove mariadb-libs-5.5.44
find / -name mariadb*
3.2、安装mysql
tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
mv /usr/local/mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql
3.3、创建相关用户及目录
groupadd -r mysql
useradd -g mysql -r -s /sbin/nologin mysql
mkdir -p /mydata/data
mkdir -p /mydata/binlog
chown mysql:mysql /mydata/data
chown mysql:mysql /mydata/binlog
3.4、服务器启动脚本
chown :mysql /usr/local/mysql -R
cd /usr/local/mysql/
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
3.5、创建配置文件
vim /etc/my.cnf
[mysqld]
bind-address = 0.0.0.0
socket=/tmp/mysql.sock
basedir=/usr/local/mysql
datadir=/mydata/data
log-bin=/mydata/binlog/log-bin
server-id=1
skip-name-resolve
3.6、设置环境变量
vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
source /etc/profile.d/mysql.sh
3.7、配置为开机启动
/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/data
systemctl start mysqld
chkconfig --add mysqld
chkconfig --list mysqld
netstat -tuanlp | grep 3306
3.8、设置root密码,授权远程连接
mysql
SET PASSWORD = PASSWORD('root123');
GRANT ALL ON mysql.* TO 'root'@'localhost' IDENTIFIED BY 'root123';
GRANT ALL ON mysql.* TO 'root'@'127.0.0.1' IDENTIFIED BY 'root123';
GRANT ALL ON mysql.* TO 'testuser'@'192.168.%.%' IDENTIFIED BY 'testpass';
FLUSH PRIVILEGES;
4、安装php-5.6.38
4.1、安装依赖包
yum -y install https://mirrors.aliyun.com/epel/7Server/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum -y install bzip2-devel libmcrypt-devel libxml2-devel
4.2、安装php
ln -s libmysqlclient.so.20.3.11 libmysqlclient_r.so
tar xf php-5.6.38.tar.gz
cd php-5.6.38
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
make && make install
4.3、复制配置文件
cp php.ini-production /etc/php.ini
4.4、修改httpd配置文件以支持php
vim /etc/httpd24/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
4.5、编写测试页
vim /usr/local/apache/htdocs/index.php
<?php
$link = mysql_connect('127.0.0.1','root','root123');
if ($link)
echo "连接数据库成功";
else
echo "连接数据库失败";
mysql_close();
phpinfo();
?>
4.6、设置环境变量
vim /etc/profile.d/php.sh
export PATH=/usr/local/php/bin/:$PATH
source /etc/profile.d/php.sh
4.7、测试
service httpd restart
5、安装phpMyAdmin-4.8.3
tar xf phpMyAdmin-4.8.3-all-languages.tar.xz
mv phpMyAdmin-4.8.3-all-languages /usr/local/apache/htdocs/pma
转载于:https://blog.51cto.com/kaiyuandiantang/2326415
52、基于模块化方式安装LAMP相关推荐
- CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin,mysql8.0.1/mysql5.7.22+centos7,windows mysql安装、配置...
介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...
- centos php rpm包,CentOS 7 RPM包方式安装LAMP
细节要求: (1) 三者分离于两台主机: (2) 一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress: (3) 提供xcache加速: (4) 为phpMyAdmin提 ...
- CentOS7安装配置Vsftpd服务器(yum方式安装)
目录 Vsftpd服务器安装配置 Vsftpd匿名用户配置 Vsftpd系统用户配置 Vsftpd虚拟用户配置 Vsftpd服务器安装配置 Vsftpd服务器端安装有两种方法:一是基于YUM方式安装: ...
- centos mysql安装包_Centos7下安装包方式安装MySQL
安装包下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar 第一步:在 /h ...
- CDH Hadoop 基于CM方式半在线安装步骤详解
CDH Hadoop基于Cloudera Manager半在线方式安装详解 1 CM简介 Cloudera Manager是一个端到端的管理CDH集群的工具.它通过管理CDH集群(组件安装.服务管理. ...
- CentOS7中基于rpm包方式安装部署apm(php module模块)+ xcache
CentOS 7, 基于rpm包方式安装部署apm(php module) : 要点: 一个虚拟主机提供phpMyAdmin,另一个虚拟主机提供wordpress: 1.配置环境: (1)关闭防火墙 ...
- Redash 9安装与配置(基于Docker方式)
Redash 9 Docker方式安装与配置详解 安装docker 卸载原系统docker apt-get remove docker docker-engine docker.io 安装docker ...
- RPM包安装LAMP及httpd虚拟机SSL实现
简单罗列基础命令,只分享我的想法! 目的:通过RPM包安装LAMP,提供两个虚拟主机,一个用于WordPress,一个用于phpMyAdmin,为后一个提供ssl访问方式. 环境是vmware的虚拟机 ...
- centos 7 安装 mantisbt-2.12.0 —— 安装LAMP环境、安装mantisbt-2.12.0
一.安装LAMP环境 1 二. 环境的启动 6 三. Mantis数据库的创建 6 四. 安装mantis-2.12.0 9 1>安装配置 9 2>登录管理员账号 13 3>新建用户 ...
最新文章
- 小规模网络数据公开数据_大规模的在线公开课程曾经是100%免费的。 但是他们没有那样做。...
- 多态时:成员特点,成员变量
- Spring知识点总结-2
- mysql 备份锁表_mysql 不停机 短时间锁表 备份 主备同步 新增备份机器
- [ROS] Chinese MOOC || Chapter-2.4 Metapackage
- 毁掉云计算项目的三个“好办法”
- 一段js动态操作table代码
- C++ _countf
- 深入 JavaScript 装饰器
- Ubuntu 20.04 更新,界面美化及安装搜狗输入法
- PHPEXCEL 不能输出中文内容,只显示空白
- PMBOK(第六版) PMP笔记——《第十二章 项目采购管理》
- 【干货资料 】简单的交换机光模块故障排查步骤
- 【数据结构】有限状态自动机(FSA)的理解-LeetCode表示数值的字符串(有效数字)题解(Java)
- java 计算间隔天数,java 计算间隔的天数
- 怎么进行PDF合并?PDF合并方法
- 零基础学摄影nbsp;人像摄影调节光…
- 精确讲述闭包及内存泄漏
- hioki电阻测试仪3540软件,微电阻计/电阻测试仪/HIOKI 3540/HIOKI 3560/日置3540/日置3560...
- 一文学会查看OSPFv3 LSDB
热门文章
- UVALive 6884 GREAT + SWERC = PORTO dfs模拟
- 【九】注入框架RoboGuice使用:(Your First Injected Service and BroadcastReceiver)
- BZOJ 1006: [HNOI2008]神奇的国度( MCS )
- 怎样查看本机到一个网站经过多少路由节点?
- android 切换主题介绍一
- 送给那些渐渐远离的朋友(转载)
- iOS开发之注册推送通知权限
- jmeter导出测试报告
- Spring的4种事务管理(1种编程式事务+三种声明事务)
- fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64