日期:2014-05-16  浏览次数:20975 次

转:通过ssh进行php、mysql、apache安装,进行配置创建数
连接到CentOS服务器:
sorry@sorry-faith:~$ ssh root@172.16.112.130
password: 需要填写root用户密码;
root@172.16.112.130's password:
Last login: Sat Dec 19 03:11:26 2009 from 172.16.112.1
[root@localhost ~]#
安装apache,mysql,php以及php连接mysql其组件:
[root@localhost ~]# yum -y install httpd php mysql mysql-server php-mysql
[root@localhost ~]# 安装过程忽略;
安装php插件:
[root@localhost ~]# yum install php-*
[root@localhost ~]# 安装过程忽略;
安装图形支持:
[root@localhost ~]# yum install php-gd
[root@localhost ~]# 安装过程忽略;
测试安装环境:
[root@localhost ~]# rpm -qa |grep mysql
[root@localhost ~]# 过程忽略;
[root@localhost ~]# rpm -qa |grep httpd
[root@localhost ~]# 过程忽略;
[root@localhost ~]# rpm -qa |grep php
[root@localhost ~]# 过程忽略;
配置开机启动服务:
配置apache开机启动;
[root@localhost ~]# /sbin/chkconfig httpd on
[root@localhost ~]# 过程忽略;
添加mysql服务;
[root@localhost ~]# /sbin/chkconfig --add mysqld
[root@localhost ~]# 过程忽略;
添加mysql开机启动;
[root@localhost ~]# /sbin/chkconfig mysqld on
[root@localhost ~]# 过程忽略;
启动httpd服务;
[root@localhost ~]# /sbin/service httpd start
[root@localhost ~]# 过程忽略;
启动mysql服务;
[root@localhost ~]# /sbin/service mysqld start
[root@localhost ~]# 过程忽略;
设置mysql密码:
pw123456修改为你要修改的密码;
[root@localhost ~]# mysqladmin -u root password 'pw123456'
[root@localhost ~]# 过程忽略;
登录到mysql:
root为你的用户名;
[root@localhost ~]# mysql -u root -p
password: 需要填写root用户密码;
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 170
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
删除test测试库;
mysql> DROP DATABASE test;
删除匿名帐户;
mysql> DELETE FROM mysql.user WHERE user = '';
重载权限;
mysql> FLUSH PRIVILEGES;
退出mysql;
mysql> exit
Bye
进入默认web目录:
[root@localhost ~]# cd /var/www/html
vi编辑创建php测试文件:
[root@localhost html]# vim info.php
进入vi编辑器:
按键“i“进入编辑模式,输入;
<?php
phpinfo();
?>
按Esc退出编辑模式后输入“:wq!”退出编辑模式;
查看本机IP;
[root@localhost html]# ifconfig
[root@localhost html]# 过程忽略;
得到IP后在浏览器输入:http://IP/info.php
php、mysql、apache已经安装配置成功。

安装dedecms:
下载:dedecms
为方便输入,修改文件名;
sorry@sorry-faith:~/桌面$ mv DedecmsV55-GBK-Final.tar.gz dede.tar.gz
使用scp命令从本地复制文件到服务器内;
sorry@sorry-faith:~/桌面$ scp dede.tar.gz root@172.16.112.130:/var/www/
password: 需要填写root用户密码;
root@172.16.112.130's password:
复制进度,100%为完成;
dede.tar.gz                                   100% 4527KB   4.4MB/s   00:01
进入www目录查看我们刚才复制上去的东西;
[root@localhost ~]# cd /var/www/
ls命令车看目录下文件;
[root@localhost www]# ls
可以看到,我们传上来的dede.tar.gz存在本目录;
cgi-bin  dede.tar.gz  error  html  icons  manual  usage
解压dede.tar.gz文件;
[root@localhost www]# tar -zxvf dede.tar.gz
[root@localhost www]# 过程忽略;
使用ls命令查看解压后目录;
[root@localhost www]# ls
解压后名字为DedeCmsV55-GBK-Final目录;
cgi-bin  DedeCmsV55-GBK-Final  dede.tar.gz  error  html  icons  manual  usage
进入DedeCmsV55-GBK-Final目录;
[root@localhost www]# cd DedeCmsV55-GBK-Final
查看目录下文件;
[root@localhost DedeCmsV55-GBK-Final]# ls
我们只需要uploads目录,因为他为安装目录文件;
修改uploads目录名,修改为html;
[root@localhost DedeCmsV55-GBK-Final]# mv uploads html
复制目录到www目录下;
[root@localhost DedeCmsV55-GBK-Final]# cp -rf html /var/www
因为默认的html目录存在,是否覆盖?我们回答“y“然后回车,确认覆盖;
cp:是否覆盖“/var/www/html/a/index.html”?
退回到www目录;