yum install lamp

yum install lamp
2011年12月11日
  [b]yum install php-*[/b]
  [b]yum install php-gd [/b]
  [b]yum -y install httpd php mysql mysql-server php-mysql[/b]
  [b]
  [/b]
  [b]yum install php-*[/b]
  [b] 65 yum install php-gd -y[/b]
  [b] 66 yum -y install httpd php mysql mysql-server php-mysql -y[/b]
  [b] 67 yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql[/b]
  [b] 68 yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc[/b]
  [b] 69 yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql[/b]
  [b] 70 /sbin/chkconfig httpd on[/b]
  [b] 71 /sbin/chkconfig --add mysqld [/b]
  [b] 72 /sbin/chkconfig mysqld on [/b]
  [b] 73 /sbin/service httpd start[/b]
  [b] 74 /sbin/service mysqld start [/b]
  [b] 75 /sbin/service mysqld restart [/b]
  [b] 76 mysqladmin -u root password 'mylove'[/b]
  [b] 77 mysql -u root -p[/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]2. 配置开机启动服务[/b]
  [b]
  [/b]
  [b]/sbin/chkconfig httpd on [设置apache服务器httpd服务开机启动][/b]
  [b]
  [/b]
  [b]/sbin/chkconfig --add mysqld [在服务清单中添加mysql服务][/b]
  [b]
  [/b]
  [b]/sbin/chkconfig mysqld on [设置mysql服务开机启动][/b]
  [b]
  [/b]
  [b]/sbin/service httpd start [启动httpd服务,与开机启动无关][/b]
  [b]
  [/b]
  [b]/sbin/service mysqld start [启动mysql服务,与开机无关][/b]
  [b]
  [/b]
  [b]3.设置mysql数据库root帐号密码。[/b]
  [b]
  [/b]
  [b]mysqladmin -u root password 'newpassword' [引号内填密码][/b]
  [b]
  [/b]
  [b]4. 让mysql数据库更安全[/b]
  [b]
  [/b]
  [b]mysql -u root -p[/b]
  [b]
  [/b]
  [b]mysql> DROP DATABASE test; [删除test数据库][/b]
  [b]
  [/b]
  [b]mysql> DELETE FROM mysql.user WHERE user = ''; [删除匿名帐户][/b]
  [b]
  [/b]
  [b]mysql> FLUSH PRIVILEGES; [重载权限][/b]
  [b]
  [/b]
  [b]5. 按照以上的安装方式, 配置出来的默认站点目录为/var/www/html/[/b]
  [b]
  [/b]
  [b]新建一个php脚本:[/b]
  [b]
  [/b]
  [b]6. 新建一个数据库,添加一个数据库用户,设置用户权限。写个php脚本测试一下数据库连接吧。[/b]
  [b]
  [/b]
  [b]mysql> CREATE DATABASE my_db;[/b]
  [b]
  [/b]
  [b]mysql> GRANT ALL PRIVILEGES ON my_db.* TO 'user'@'localhost' IDENTIFIED BY 'password';[/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]//安装apache扩展[/b]
  [b]
  [/b]
  [b]yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql[/b]
  [b]
  [/b]
  [b]//安装php的扩展[/b]
  [b]
  [/b]
  [b]yum install php-gd[/b]
  [b]
  [/b]
  [b]yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc[/b]
  [b]
  [/b]
  [b]//安装mysql扩展[/b]
  [b]
  [/b]
  [b]yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql[/b]
  [b]
  [/b]
  [b]# mysql[/b]
  [b]
  [/b]
  [b]ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [/b]
  [b]
  [/b]
  [b]""mysql dead but subsys locked[/b]
  [b]
  [/b]
  [b]解决办法如下:[/b]
  [b]
  [/b]
  [b]# rm -fr /var/lib/mysql/*[/b]
  [b]
  [/b]
  [b]# rm /var/lock/subsys/mysql[/b]
  [b]
  [/b]
  [b]rm: remove regular empty file `/var/lock/subsys/mysqld'? yes[/b]
  [b]
  [/b]
  [b]shell> killall mysqld[/b]
  [b]
  [/b]
  [b]shell> service mysqld start[/b]
  [b]
  [/b]
  [b]# /etc/rc.d/init.d/mysqld status[/b]
  [b]
  [/b]
  [b]mysqld (pid 5457) is running...[/b]
  [b]
  [/b]
  [b]###数据库运行正常;[/b]
  [b]
  [/b]
  [b]一、两个重要目录:[/b]
  [b]
  [/b]
  [b]  Apache有两个重要的目录:1、配置目录 /etc/httpd/conf;2、文档目录 /var/www:[/b]
  [b]
  [/b]
  [b]  [/b]
  [b]
  [/b]
  [b]  二、两种配置模式:[/b]
  [b]
  [/b]
  [b]  Apache在Fedora下的两种配置方式:文本模式(终端命令行)和图形化配置。两者各有优势:图形化下配置,更容易上手,在文本模式下直接编辑httpd.conf文件,自由性更强些、更直接。[/b]
  [b]
  [/b]
  [b]  三、Apache服务的启动与关闭[/b]
  [b]
  [/b]
  [b]  Apache服务的停止、启动、关闭可以通过两种模式下进行操作:文本(终端)模式下和图形化界面。[/b]
  [b]
  [/b]
  [b]  四、终端下的操作[/b]
  [b]
  [/b]
  [b]  如果你想用Linux作为WWW服务器,我建议不要安装图形界面(即X window、KDE或GNOME桌面),很显然不安装这些程序,会显著提高系统的性能,易操作性和美丽的界面是要付出代价。我认为Linux的精髓在于命令行的丰富。Linux的命令可以完成所有任务。[/b]
  [b]
  [/b]
  [b]  1、Apache的启动、重启、停止服务:[/b]
  [b]
  [/b]
  [b] cd /etc/init.d命令切换到 /etc/init.d目录,运行如下命令:[/b]
  [b]
  [/b]
  [b] ./httpd start //启动Apache服务[/b]
  [b]
  [/b]
  [b] ./httpd restart //重新启动Apache服务[/b]
  [b]
  [/b]
  [b] ./httpd stop //停止Apache服务[/b]
  [b]
  [/b]
  [b]  开机自动启动Apache服务[/b]
  [b]
  [/b]
  [b]  cd /sbin命令切换到/sbin目录,运行chkconfig命令,参数:./chkconfig --level 5 httpd on[/b]
  [b]
  [/b]
  [b]  ./chkconfig --list可以检查一下httpd开机是否自动启动,如果5:启动,表示开机自动启动。[/b]
  [b]
  [/b]
  [b]  2、配置[/b]
  [b]
  [/b]
  [b]  cd /etc/httpd/conf命令切换到目录/etc/httpd/conf,用vi编辑器打开、编辑httpd.conf配置,在配置之前,为了防止配置出错,先备份[/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b]
  [/b]
  [b][/b]
  [b]
  [/b]
  [b]保存为info.php放到网站目录[/b]
  [b]
  [/b]
  [b]然后输入http://ip/info.php看看测试环境[/b]
  [b]
  [/b]
  [b]2安装Apache+php+Mysql#[/b]
  [b]
  [/b]
  [b]a.用yum安装前.先是替换为中国CentOS镜像服务器!中国官方镜像网站: http://centos.ustc.edu.cn/ [/b]
  [b]
  [/b]
  [b]安装后请按照以下步骤修改CenOS-Base.repo,以后就可以方便的用yum安装软件了[/b]
  [b]
  [/b]
  [b]cd /etc/yum.repos.d[/b]
  [b]
  [/b]
  [b]mv CentOS-Base.repo CentOS-Base.repo.save[/b]
  [b]
  [/b]
  [b]wget http://centos.ustc.edu.cn/CentOS-Base.repo.5[/b]
  [b]
  [/b]
  [b]mv CentOS-Base.repo.5 CentOS-Base.repo[/b]
  [b]
  [/b]
  [b]b、更新系统内核到最新. yum -y update[/b]
  [b]
  [/b]
  [b]c、安装Apahce, PHP, Mysql, 以及php连接mysql库组件[/b]
  [b]
  [/b]
  [b]yum -y install httpd php mysql mysql-server php-mysql[/b]
  [b]
  [/b]
  [b]d、安装mysql扩展[/b]
  [b]
  [/b]
  [b]yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql[/b]
  [b]
  [/b]
  [b]或一次性粘贴安装[/b]
  [b]
  [/b]
  [b]yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql[/b]
  [b]
  [/b]
  [b]设置mysql数据库root帐号密码[/b]
  [b]
  [/b]
  [b]mysqladmin -u root password ‘newpassword’[/b]
  [b]
  [/b]
  [b][引号内填密码][/b]
  [b]
  [/b]
  [b]f、 让mysql数据库更安全[/b]
  [b]
  [/b]
  [b]mysql -u root -p [此时会要求你输入刚刚设置的密码,输入后回车即可[/b]
  [b]
  [/b]
  [b]mysql> DROP DATABASE test; [删除test数据库][/b]
  [b]
  [/b]
  [b]mysql> DELETE FROM mysql.user WHERE user = ”; [删除匿名帐户][/b]
  [b]
  [/b]
  [b]mysql> FLUSH PRIVILEGES; [重载权限][/b]
  [b]
  [/b]
  [b]按照以上的安装方式, 配置出来的默认站点目录为/var/www/html/新建一个php脚本[/b]
  [b]
  [/b]
  [b][/b]
  [b]
  [/b]
  [b]配置防火墙4添加允许访问HTTP、FTP端口[/b]
  [b]
  [/b]
  [b]iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT[/b]
  [b]
  [/b]
  [b]iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT[/b]
  [b]
  [/b]
  [b]重启iptables: service iptables restart[/b]
  [b]
  [/b]
  [b]安装phpMyAdmin)[/b]
  [b]
  [/b]
  [b]进入phpMyAdmin官方下载(不要最新版本,下phpMyAdmin 2.11.9.5就行了,3.1以上需php 5.2以上),上传到你的网站目录下,然后进行配置。只需几步即可搞定。[/b]
  [b]
  [/b]
  [b]I.[/b]
  [b]
  [/b]
  [b]config.sample.inc.php更名为config.inc.php;[/b]
  [b]
  [/b]
  [b]II.[/b]
  [b]
  [/b]
  [b]打开config.inc.php文件,进行以下修改:[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['controluser'] = ‘pma’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['controlpass'] = ‘pmapass’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['relation'] = ‘pma_relation’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['history'] = ‘pma_history’;[/b]
  [b]
  [/b]
  [b]// $cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’[/b]
  [b]
  [/b]
  [b]去掉每行前面的//;[/b]
  [b]
  [/b]
  [b]II.[/b]
  [b]
  [/b]
  [b]$cfg['blowfish_secret'] = ”; |修改为| $cfg['blowfish_secret'] = ‘http’[/b]
  [b]
  [/b]
  [b]V.[/b]
  [b]
  [/b]
  [b]$cfg['Servers'][$i]['controluser'] = ‘pma’; |把’pma’修改为你的帐号|$cfg['Servers'][$i]['controlpass'] = ‘pmapass’; |把’pmapass设置为你的mysql登录密码|[/b]
  [b]
  [/b]
  [b]V.[/b]
  [b]
  [/b]
  [b]V. $cfg['blowfish_secret'] = ”; | 添加短语密码例如:$cfg['blowfish_secret'] = ‘onohot’[/b]
  [b]
  [/b]
  [b]6、//安装php的扩展[/b]
  [b]
  [/b]
  [b]yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc[/b]
  [b]
  [/b]
  [b]7、//安装apache扩展[/b]
  [b]
  [/b]
  [b]yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql[/b]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值