Linux 快速安装 LAMP环境
#检查一下系统更新 初次安装可能更新的时间会比较长,请耐心等待。
yum update
#安装gcc软件编译环境。
yum install gcc gcc-c++
#卸载系统自带的httpd
yum erase httpd
yum install zlib-devel libtool ncurses-devel libxml2-devel
/*(zlib-devel 安装apache需要,否则出错 .libtool安装mysql时候需要.同时附带了autoconf automake imake 编译mysql 5.1.48时候会出错 需要autoconf重新配置一下)*/
以上为一些准备工作,使用yum安装LAMP的前提准备。接下开始安装各个组件。
安装apache
yum install httpd httpd-devel
/etc/init.d/httpd start #安装好之后启动apache
安装mysql
yum install mysql mysql-server mysql-devel
/etc/init.d/mysqld start #启动mysql服务
设置mysql密码:
直接使用"mysql"进入数据库模式,
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql -u root -p
Enter Password:
创建一个用户管理数据库
mysql > create database demo
mysql >GRANT ALL PRIVILEGES ON demo.* TO 'guest'@'localhost' IDENTIFIED BY 'guest' WITH GRANT OPTION;
mysql> UPDATE user SET Password=PASSWORD('guest') WHERE user='guest';
安装php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd restart #安装好php之后重启httpd
安装phpmyadmin
cd /var/www/html
wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.2.2/phpMyAdmin-3.5.2.2-all-languages.tar.gz?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Fdownloads.php&ts=1345431806&use_mirror=iweb
tar -zxf phpMyAdmin-3.5.2.2-all-languages.tar.gz
mv phpMyAdmin-3.5.2.2-all-languages phpmyadmin
mv phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.php
#编辑phpmyadmin配置
vi phpmyadmin/config.inc.php
设置成
开机启动:
chkconfig httpd on
chkconfig mysqld on
安装squid组件
yum -y install squid
最后需要打开防火墙
#开启80端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
#保存修改规则
/etc/rc.d/init.d/iptables save
#查看状态
/etc/init.d/iptables status
安装环境
[root@localhost html]# uname -a
Linux localhost.localdomain 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost html]# cat /etc/centos-release
CentOS release 6.3 (Final)
[root@localhost html]#
- 大小: 239.1 KB
- 大小: 252.6 KB