CentOS 5.5使用yum来安装LAMP(php运行环境)

今天用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- r e l e a s e v e r − B a s e b a s e u r l = h t t p : / / m i r r o r s . s o h u . c o m / c e n t o s / releasever - Base baseurl=http://mirrors.sohu.com/centos/ releaseverBasebaseurl=http://mirrors.sohu.com/centos/releasever/os/KaTeX parse error: Expected 'EOF', got '#' at position 84: …-KEY-CentOS-5 #̲released update…releasever - Updates
baseurl=http://mirrors.sohu.com/centos/ r e l e a s e v e r / u p d a t e s / releasever/updates/ 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- r e l e a s e v e r − A d d o n s b a s e u r l = h t t p : / / m i r r o r s . s o h u . c o m / c e n t o s / releasever - Addons baseurl=http://mirrors.sohu.com/centos/ releaseverAddonsbaseurl=http://mirrors.sohu.com/centos/releasever/addons/KaTeX parse error: Expected 'EOF', got '#' at position 84: …-KEY-CentOS-5 #̲additional pack…releasever - Extras
baseurl=http://mirrors.sohu.com/centos/ r e l e a s e v e r / e x t r a s / releasever/extras/ 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- r e l e a s e v e r − P l u s b a s e u r l = h t t p : / / m i r r o r s . s o h u . c o m / c e n t o s / releasever - Plus baseurl=http://mirrors.sohu.com/centos/ releaseverPlusbaseurl=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 VPS云主机
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:
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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值