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
4.3然后在客户端浏览器里打开http://serverip/test.php,若能成功显示,则表示安装成功。
至此,安装完毕。感慨,yum真是太好用了。
CentOS 5.5使用yum来安装LAMP(php运行环境)
2021-03-14 22:24CentOS教程网 Centos
今天用yum方法搭建起了个LAMP环境,中间遇到了很多问题,经过google和各位前辈的帮助,终于将环境搭建起来,现在把完整的步骤记录下来
延伸 · 阅读
- 2021-03-14centos redhat系列对抗ddos之居家必备利器 banip.txt
- 2021-03-13yum下载docker安装包安装到离线机器的实例代码详
- 2021-03-12CentOS 7上安装Docker 1.8 的步骤详解
- 2021-03-11VMware下CentOS静默安装oracle12.2详细图文教程
- 2021-03-09centos 下docker 安装方法
- 2021-03-08VMware14 上安装CentOS 7 图文教程
- Centos
让Centos解压打包RAR的实现方法
默认情况下centos是不支持winrar的解压与打包的,需要安装winrar的linux版本程序 ...
- Centos
CentOS系统中安装高亮vim编辑工具的方法
这篇文章主要介绍了CentOS系统中安装高亮vim编辑工具的方法,需要的朋友可以参考下 ...
- Centos
CentOS7.0安装Scala和sun jdk的方法
CentOS7.0如何安装Scala和sun jdk?下面小编将为大家带来CentOS7.0安装Scala和sun jdk的方法!希望能够帮助到大家!有需要的朋友一起去看看吧...
- Centos
pptp及l2tp安装教程篇一安装pptp方法
网上已经有了pptp和l2tp的一键安装包,虽然很方便,但是大部分的网上教程和安装包都是需要编译的,其实合理利用各种各样的源,可以省却不少功夫,安...
- Centos
怎么破解CentOS的root密码?具体该如何操作
很多新手朋友们都不知道如何破解CentOS的root密码?其实不难,开机后,在倒数读秒的时候按任意键、跳转画面后,再按E键,接下来的操作祥看本文就可以...
- Centos
CentOS 安装vsftp 建新用户的方法
这篇文章主要介绍了CentOS下如何安装vsftp并创建用户的方法,需要的朋友可以参考下 ...
- Centos
CentOS6.4系统中Mysql数据库卸载、安装与配置教程[图文]
就像Windows server 2003,2008中一般安装的是Sql Server 数据库,在linux系统中一般安装的是mysql数据库,而且Mysql数据库的第一个版本就是发行在Linux系统上的 ...
- Centos
CentOS6.5挂载超过16T的大容量存储空间讲解
今天小编为大家带来的是CentOS6.5挂载超过16T的大容量存储空间讲解;希望对大家会有帮助,有需要的朋友一起去看看吧...