今天用yum方法搭建起了个LAMP环境,中间遇到了很多问题,经过google和各位前辈的帮助,终于将环境搭建起来,现在把完整的步骤记录下来,
1. 换源,sohu的相当好用。
1.1备份CentOS-Base.repo
cd /etc/yum.repos.d/
cp CentOS-Base.repo CentOS-Base.repo.bak
1.2替换源
用vi打开CentOS-Base.repo,并将内容清空,然后将下面的内容复制进去,并保存。
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
1.3更新一下。
yum -y update
2. 用yum安装Apache,Mysql,PHP.
2.1安装Apache
yum install httpd httpd-devel
安装完成后,用/etc/init.d/httpd start 启动apache
设为开机启动:chkconfig httpd on
2.2 安装mysql
2.2.1 yum install mysql mysql-server mysql-devel
同样,完成后,用/etc/init.d/mysqld start 启动mysql
2.2.2 设置mysql密码
mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql>; FLUSH PRIVILEGES;
2.2.3 允许远程登录
mysql -u root -p
Enter Password: <your new password>
mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
完成后就能用mysql-front远程管理mysql了。
2.2.4 设为开机启动
chkconfig mysqld on
3. 安装php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start
4. 测试一下
4.1在/var/www/html/新建个test.php文件,将以下内容写入,然后保存。
<?
phpinfo();
?>
4.2 防火墙配置
a.添加.允许访问端口{21: ftp, 80: http}.
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
b.关闭防火墙{不推荐}.
service iptables stop
c.重置加载防火墙
service iptables restart
至此,安装完毕。感慨,yum真是太好用了。
本文出自 “至爱吾爱” 博客,请务必保留此出处http://myohmy.blog.51cto.com/140917/327310再进行修改
相关推荐
CentOS 5.5使用yum安装Apache+PHP+MySQL 一、安装centos5.5操作系统 二、系统安装 三、安装Apache+php+Mysql 四、 配置防火墙 五、安装phpMyAdmin 六、安装php的扩展 七、安装apache扩展 八、如果想升级PHP的话
Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版Centos5.5下安装LAMP完整版
centos7使用yum安装lamp(apache+mariadb+php) php默认版本是5.4.16
1.1备份CentOS-Base.repo cd /etc/yum.repos.d/ cp CentOS-Base.repo CentOS-Base.repo.bak 1.2替换源 用vi打开CentOS-Base.repo,并将内容清空,然后将下面的内容复制进去,并保存。 # CentOS-Base.repo # # This ...
Centos5.5下Qt的安装配置
在 CentOS5.5b上安装LAMP
Linux CentOS5.5 web配置
这个教程自己已经在centos5.5上一个个试出来的 包括lamp安装过程出现的问题都有记录,安装的步骤参考与别人的经验,我只是做了个总结及问题归总,用该文档我已经装好了好多台服务器了。 该文档包括apache的安装,php...
Oracle CentOS5.5 命令行
CentOS 5.5安装全过程 这个介绍的很细的。
CentOS 5.5搭建PHP环境安装笔记
集合网上资料和自身实际安装整理的centos5.5安装mysql5.5,文档中有5.5和5.6的下载地载,如果安装5.6还需要找一点资料。
CentOS 5.5 yum 搭建 Apache+PHP5+MySQL
centos 5.5 虚拟机安装截图教程,可能安装过程中会因虚拟机版本和centos的版本区别有所不同,但是基本思路应该没变,希望对大家有用,我没资源分了,大家支持下让人赚点分吧,谢谢各位了
CentOS 5.5提权exp
centOS5.5下java环境配置 centOS5.5下java环境配置 centOS5.5下java环境配置
centos5.5安装oracle10g: 自己写的文档,学习用的,供大家参考