当前位置:阳光沙滩 >Linux > 查看文章
阿里云优惠码

背景:

电脑是mac,服务器是CentOS6.5

==================================

这样用起来也方便,自带的SSH,FTP都不用安装了,直接使用SSH的sFtp就可以了。

那么连接服务器也是非常简单的一件事,可以看这篇吧:如何用mac自带的SSH连接远程的Linux服务器呢

连接上会提示欢迎信息的哈!

1.安装apache

直接输入指令:

yum install httpd

提示:

Loaded plugins: security
base                                                     | 3.7 kB     00:00     
base/primary_db                                          | 4.7 MB     00:04     
epel                                                     | 4.3 kB     00:00     
epel/primary_db                                          | 5.9 MB     00:05     
extras                                                   | 3.4 kB     00:00     
extras/primary_db                                        |  37 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/primary_db                                       | 3.1 MB     00:02     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-54.el6.centos will be installed
--> Processing Dependency: httpd-tools = 2.2.15-54.el6.centos for package: httpd-2.2.15-54.el6.centos.x86_64
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-54.el6.centos.x86_64
--> Running transaction check
---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package httpd-tools.x86_64 0:2.2.15-54.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch        Version                      Repository    Size
================================================================================
Installing:
 httpd              x86_64      2.2.15-54.el6.centos         updates      833 k
Installing for dependencies:
 apr-util-ldap      x86_64      1.3.9-3.el6_0.1              base          15 k
 httpd-tools        x86_64      2.2.15-54.el6.centos         updates       79 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 927 k
Installed size: 3.1 M
Is this ok [y/N]: y

O不Ok ,必须的嘛 —> Is this ok [y/N]: y

然后又哗啦哗啦地跑了!

Downloading Packages:
(1/3): apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm          |  15 kB     00:00     
(2/3): httpd-2.2.15-54.el6.centos.x86_64.rpm             | 833 kB     00:00     
(3/3): httpd-tools-2.2.15-54.el6.centos.x86_64.rpm       |  79 kB     00:00     
--------------------------------------------------------------------------------
Total                                           971 kB/s | 927 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64                         1/3 
  Installing : httpd-tools-2.2.15-54.el6.centos.x86_64                      2/3 
  Installing : httpd-2.2.15-54.el6.centos.x86_64                            3/3 
  Verifying  : httpd-tools-2.2.15-54.el6.centos.x86_64                      1/3 
  Verifying  : httpd-2.2.15-54.el6.centos.x86_64                            2/3 
  Verifying  : apr-util-ldap-1.3.9-3.el6_0.1.x86_64                         3/3 

Installed:
  httpd.x86_64 0:2.2.15-54.el6.centos                                           

Dependency Installed:
  apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1                                        
  httpd-tools.x86_64 0:2.2.15-54.el6.centos                                     

Complete!

看到上面这个单词出现,乐坏了,是吧!哈哈,这应该是初中学的吧!完成了!

接下来,我们是不是要爽一把呀,启动apache服务器呗!

怎么启动呢,看码:

service httpd start

这种是比较简单的方式,还有一种就是进入配置目录启动,贫僧不喜欢这种:

/etc/init.d/httpd start

好吧,不管黑猫白猫,会抓老鼠的就是猫。

但是,注意了,哈哈,提示这个,有不有?(可能显示不完,意思一下得了)

Starting httpd: httpd: Could not reliably determine the server's fully 
qualified domain name, using 【ip地址】 for ServerName
                                                           [  OK  ]

什么意思呀?我也不知道,嘻嘻。毕竟我是做完英语听力就交卷的人。

可能的意思是:开启httpd,然后呢,这玩意思不可以确切地生命域名,所以就用这个Ip地址作为域名。

那问题来了,咋整呢?

好说,是吧!打开配置文件:

cd /etc/httpd/conf

切换到上面这个目录,可以ls一下看到如下:

httpd.conf  magic

对,就是这货了,httpd.conf。然后用编辑器打开,用vi就可以了。

vi httpd.conf

但是一看,太多内容了是吧,上下移动都看不完。那么就进入命令模式查找一下吧:

:/ServerName

按n往下找,找到这一个:

#ServerName www.example.com:80

把前面的#去掉(进入编辑模式删除即可,然后wq保存退出,如果怕自己操作失败的,那么就备份一下吧。),那么你的服务器名称,就是这域名啦,自己起啦!

一般来说,我们的apache要随关开机而启动的,所以我们还要做一件事,就是开机启动apache

chkconfig httpd on

执行完,没消息是吧,没消息就是好消息哈!

那么,到这里的话,就安装完了Apache服务器了。

2. Mysql数据库的安装

mysql的安装也很简单,安装命令如下:

yum install mysql mysql-server

提示:

Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-7.el6 will be installed
--> Processing Dependency: mysql-libs = 5.1.73-7.el6 for package: mysql-5.1.73-7.el6.x86_64
---> Package mysql-server.x86_64 0:5.1.73-7.el6 will be installed
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-7.el6.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-7.el6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-7.el6.x86_64
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be updated
---> Package mysql-libs.x86_64 0:5.1.73-7.el6 will be an update
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package                  Arch             Version                 Repository      Size
========================================================================================
Installing:
 mysql                    x86_64           5.1.73-7.el6            base           894 k
 mysql-server             x86_64           5.1.73-7.el6            base           8.6 M
Installing for dependencies:
 perl-DBD-MySQL           x86_64           4.013-3.el6             base           134 k
 perl-DBI                 x86_64           1.609-4.el6             base           705 k
Updating for dependencies:
 mysql-libs               x86_64           5.1.73-7.el6            base           1.2 M

Transaction Summary
========================================================================================
Install       4 Package(s)
Upgrade       1 Package(s)

Total download size: 12 M
Is this ok [y/N]: y

还是y即可进行下载安装:

Downloading Packages:
(1/5): mysql-5.1.73-7.el6.x86_64.rpm                             | 894 kB     00:00     
(2/5): mysql-libs-5.1.73-7.el6.x86_64.rpm                        | 1.2 MB     00:00     
(3/5): mysql-server-5.1.73-7.el6.x86_64.rpm                      | 8.6 MB     00:08     
(4/5): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm                     | 134 kB     00:00     
(5/5): perl-DBI-1.609-4.el6.x86_64.rpm                           | 705 kB     00:00     
----------------------------------------------------------------------------------------
Total                                                   1.1 MB/s |  12 MB     00:10     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : mysql-libs-5.1.73-7.el6.x86_64                                       1/6 
  Installing : perl-DBI-1.609-4.el6.x86_64                                          2/6 
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                                    3/6 
  Installing : mysql-5.1.73-7.el6.x86_64                                            4/6 
  Installing : mysql-server-5.1.73-7.el6.x86_64                                     5/6 
  Cleanup    : mysql-libs-5.1.73-3.el6_5.x86_64                                     6/6 
  Verifying  : mysql-5.1.73-7.el6.x86_64                                            1/6 
  Verifying  : mysql-libs-5.1.73-7.el6.x86_64                                       2/6 
  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                                    3/6 
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                          4/6 
  Verifying  : mysql-server-5.1.73-7.el6.x86_64                                     5/6 
  Verifying  : mysql-libs-5.1.73-3.el6_5.x86_64                                     6/6 

Installed:
  mysql.x86_64 0:5.1.73-7.el6             mysql-server.x86_64 0:5.1.73-7.el6            

Dependency Installed:
  perl-DBD-MySQL.x86_64 0:4.013-3.el6           perl-DBI.x86_64 0:1.609-4.el6          

Dependency Updated:
  mysql-libs.x86_64 0:5.1.73-7.el6                                                      

Complete!

嗯,安装完成了!欧耶!

再爽一把,启动Mysql服务,我只说一种就够了哈,嘻嘻!

service mysqld start

提示:

Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iZuf6innyuqc4mbvq0oycgZ password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

另外我们还有一件事,就是这个MySQL的服务,也要在开机的时候启动。所以和前面我们配置Apache的时候 ,一样设置即可:

chkconfig mysqld on

不对,是不是差点什么呢?哈哈,密码没有设置,对吧!

怎么设置呢,也很简单:

mysql_secure_installation

提示曰(yue):

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 

意思大概就是说:这个安全设置是为的有的服务设置的,请你认真阅读每一个步骤。为了确保安全,我们需要为root用户录入密码,如果你仅仅安装了MySQL,但是你并没有设置密码,那么,这个密码默认为空的。也就是说,我们直接回车,就可以进入了。

直接回车以后提示说:

Set root password? [Y/n] y
New password: 

让我们设置新的密码。

我们输入密码一次,再确定一次,回车。就可以了。

后面还有一些配置请参考之前写的windowsMySql的安装和配置(图文+视频)下的Mysql配置,大同小异。

直到这里,就完成了:

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

我们可以测试一下,直接登陆一下mysql数据库:

# mysql -uroot -p

回车,如下,也就是进入了mysql数据库了。

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

3.PHP及相关模块的安装

话不多说,直接上:

yum install php

提示:

Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-48.el6_8 for package: php-5.3.3-48.el6_8.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.3-48.el6_8 for package: php-5.3.3-48.el6_8.x86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package php-common.x86_64 0:5.3.3-48.el6_8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch           Version                Repository       Size
================================================================================
Installing:
 php                x86_64         5.3.3-48.el6_8         updates         1.1 M
Installing for dependencies:
 php-cli            x86_64         5.3.3-48.el6_8         updates         2.2 M
 php-common         x86_64         5.3.3-48.el6_8         updates         530 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 3.8 M
Installed size: 13 M
Is this ok [y/N]: 

直接y即可下载安装:

Is this ok [y/N]: y
Downloading Packages:
(1/3): php-5.3.3-48.el6_8.x86_64.rpm                     | 1.1 MB     00:00     
(2/3): php-cli-5.3.3-48.el6_8.x86_64.rpm                 | 2.2 MB     00:01     
(3/3): php-common-5.3.3-48.el6_8.x86_64.rpm              | 530 kB     00:00     
--------------------------------------------------------------------------------
Total                                           1.2 MB/s | 3.8 MB     00:03     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-common-5.3.3-48.el6_8.x86_64                             1/3 
  Installing : php-cli-5.3.3-48.el6_8.x86_64                                2/3 
  Installing : php-5.3.3-48.el6_8.x86_64                                    3/3 
  Verifying  : php-common-5.3.3-48.el6_8.x86_64                             1/3 
  Verifying  : php-cli-5.3.3-48.el6_8.x86_64                                2/3 
  Verifying  : php-5.3.3-48.el6_8.x86_64                                    3/3 

Installed:
  php.x86_64 0:5.3.3-48.el6_8                                                   

Dependency Installed:
  php-cli.x86_64 0:5.3.3-48.el6_8       php-common.x86_64 0:5.3.3-48.el6_8      

Complete!

安装相关的模块,这里的话,一次性安装完啦:

yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt 

提示后直接y就可以往下安装了:

Loaded plugins: security
Setting up Install Process
Package libjpeg-turbo-1.2.1-3.el6_5.x86_64 already installed and latest version
No package php-mhash available.
Resolving Dependencies
--> Running transaction check
---> Package libjpeg-turbo-devel.x86_64 0:1.2.1-3.el6_5 will be installed
---> Package libjpeg-turbo-static.x86_64 0:1.2.1-3.el6_5 will be installed
---> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed
---> Package php-bcmath.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package php-gd.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.3.3-48.el6_8.x86_64
---> Package php-imap.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: libc-client.so.2007()(64bit) for package: php-imap-5.3.3-48.el6_8.x86_64
---> Package php-ldap.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package php-mbstring.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package php-mcrypt.x86_64 0:5.3.3-5.el6 will be installed
---> Package php-mysql.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-48.el6_8.x86_64
---> Package php-odbc.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: libodbc.so.2()(64bit) for package: php-odbc-5.3.3-48.el6_8.x86_64
---> Package php-pear.noarch 1:1.9.4-5.el6 will be installed
---> Package php-xml.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.3.3-48.el6_8.x86_64
---> Package php-xmlrpc.x86_64 0:5.3.3-48.el6_8 will be installed
--> Running transaction check
---> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed
---> Package libc-client.x86_64 0:2007e-11.el6 will be installed
---> Package libxslt.x86_64 0:1.1.26-2.el6_3.1 will be installed
---> Package php-pdo.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package unixODBC.x86_64 0:2.2.14-14.el6 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.2.14-14.el6.x86_64
--> Running transaction check
---> Package libtool-ltdl.x86_64 0:2.2.6-15.5.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch        Version               Repository    Size
================================================================================
Installing:
 libjpeg-turbo-devel       x86_64      1.2.1-3.el6_5         base          96 k
 libjpeg-turbo-static      x86_64      1.2.1-3.el6_5         base         108 k
 libmcrypt                 x86_64      2.5.8-9.el6           epel          96 k
 php-bcmath                x86_64      5.3.3-48.el6_8        updates       39 k
 php-gd                    x86_64      5.3.3-48.el6_8        updates      111 k
 php-imap                  x86_64      5.3.3-48.el6_8        updates       55 k
 php-ldap                  x86_64      5.3.3-48.el6_8        updates       43 k
 php-mbstring              x86_64      5.3.3-48.el6_8        updates      460 k
 php-mcrypt                x86_64      5.3.3-5.el6           epel          19 k
 php-mysql                 x86_64      5.3.3-48.el6_8        updates       86 k
 php-odbc                  x86_64      5.3.3-48.el6_8        updates       56 k
 php-pear                  noarch      1:1.9.4-5.el6         base         393 k
 php-xml                   x86_64      5.3.3-48.el6_8        updates      108 k
 php-xmlrpc                x86_64      5.3.3-48.el6_8        updates       57 k
Installing for dependencies:
 libXpm                    x86_64      3.5.10-2.el6          base          51 k
 libc-client               x86_64      2007e-11.el6          base         515 k
 libtool-ltdl              x86_64      2.2.6-15.5.el6        base          44 k
 libxslt                   x86_64      1.1.26-2.el6_3.1      base         452 k
 php-pdo                   x86_64      5.3.3-48.el6_8        updates       80 k
 unixODBC                  x86_64      2.2.14-14.el6         base         378 k

Transaction Summary
================================================================================
Install      20 Package(s)

Total download size: 3.2 M
Installed size: 11 M
Is this ok [y/N]: y
Downloading Packages:
(1/20): libXpm-3.5.10-2.el6.x86_64.rpm                   |  51 kB     00:00     
(2/20): libc-client-2007e-11.el6.x86_64.rpm              | 515 kB     00:00     
(3/20): libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpm     |  96 kB     00:00     
(4/20): libjpeg-turbo-static-1.2.1-3.el6_5.x86_64.rpm    | 108 kB     00:00     
(5/20): libmcrypt-2.5.8-9.el6.x86_64.rpm                 |  96 kB     00:00     
(6/20): libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm           |  44 kB     00:00     
(7/20): libxslt-1.1.26-2.el6_3.1.x86_64.rpm              | 452 kB     00:00     
(8/20): php-bcmath-5.3.3-48.el6_8.x86_64.rpm             |  39 kB     00:00     
(9/20): php-gd-5.3.3-48.el6_8.x86_64.rpm                 | 111 kB     00:00     
(10/20): php-imap-5.3.3-48.el6_8.x86_64.rpm              |  55 kB     00:00     
(11/20): php-ldap-5.3.3-48.el6_8.x86_64.rpm              |  43 kB     00:00     
(12/20): php-mbstring-5.3.3-48.el6_8.x86_64.rpm          | 460 kB     00:00     
(13/20): php-mcrypt-5.3.3-5.el6.x86_64.rpm               |  19 kB     00:00     
(14/20): php-mysql-5.3.3-48.el6_8.x86_64.rpm             |  86 kB     00:00     
(15/20): php-odbc-5.3.3-48.el6_8.x86_64.rpm              |  56 kB     00:00     
(16/20): php-pdo-5.3.3-48.el6_8.x86_64.rpm               |  80 kB     00:00     
(17/20): php-pear-1.9.4-5.el6.noarch.rpm                 | 393 kB     00:00     
(18/20): php-xml-5.3.3-48.el6_8.x86_64.rpm               | 108 kB     00:00     
(19/20): php-xmlrpc-5.3.3-48.el6_8.x86_64.rpm            |  57 kB     00:00     
(20/20): unixODBC-2.2.14-14.el6.x86_64.rpm               | 378 kB     00:00     
--------------------------------------------------------------------------------
Total                                           2.0 MB/s | 3.2 MB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-pdo-5.3.3-48.el6_8.x86_64                               1/20 
  Installing : libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64                    2/20 
  Installing : libtool-ltdl-2.2.6-15.5.el6.x86_64                          3/20 
  Installing : unixODBC-2.2.14-14.el6.x86_64                               4/20 
  Installing : libc-client-2007e-11.el6.x86_64                             5/20 
  Installing : libmcrypt-2.5.8-9.el6.x86_64                                6/20 
  Installing : libXpm-3.5.10-2.el6.x86_64                                  7/20 
  Installing : libxslt-1.1.26-2.el6_3.1.x86_64                             8/20 
  Installing : php-xml-5.3.3-48.el6_8.x86_64                               9/20 
  Installing : php-gd-5.3.3-48.el6_8.x86_64                               10/20 
  Installing : php-mcrypt-5.3.3-5.el6.x86_64                              11/20 
  Installing : php-imap-5.3.3-48.el6_8.x86_64                             12/20 
  Installing : php-odbc-5.3.3-48.el6_8.x86_64                             13/20 
  Installing : libjpeg-turbo-static-1.2.1-3.el6_5.x86_64                  14/20 
  Installing : php-mysql-5.3.3-48.el6_8.x86_64                            15/20 
  Installing : php-bcmath-5.3.3-48.el6_8.x86_64                           16/20 
  Installing : php-xmlrpc-5.3.3-48.el6_8.x86_64                           17/20 
  Installing : php-ldap-5.3.3-48.el6_8.x86_64                             18/20 
  Installing : php-mbstring-5.3.3-48.el6_8.x86_64                         19/20 
  Installing : 1:php-pear-1.9.4-5.el6.noarch                              20/20 
  Verifying  : libjpeg-turbo-static-1.2.1-3.el6_5.x86_64                   1/20 
  Verifying  : php-gd-5.3.3-48.el6_8.x86_64                                2/20 
  Verifying  : libxslt-1.1.26-2.el6_3.1.x86_64                             3/20 
  Verifying  : libXpm-3.5.10-2.el6.x86_64                                  4/20 
  Verifying  : 1:php-pear-1.9.4-5.el6.noarch                               5/20 
  Verifying  : php-mcrypt-5.3.3-5.el6.x86_64                               6/20 
  Verifying  : php-imap-5.3.3-48.el6_8.x86_64                              7/20 
  Verifying  : php-mbstring-5.3.3-48.el6_8.x86_64                          8/20 
  Verifying  : libmcrypt-2.5.8-9.el6.x86_64                                9/20 
  Verifying  : libc-client-2007e-11.el6.x86_64                            10/20 
  Verifying  : php-mysql-5.3.3-48.el6_8.x86_64                            11/20 
  Verifying  : libtool-ltdl-2.2.6-15.5.el6.x86_64                         12/20 
  Verifying  : php-ldap-5.3.3-48.el6_8.x86_64                             13/20 
  Verifying  : php-odbc-5.3.3-48.el6_8.x86_64                             14/20 
  Verifying  : unixODBC-2.2.14-14.el6.x86_64                              15/20 
  Verifying  : php-xmlrpc-5.3.3-48.el6_8.x86_64                           16/20 
  Verifying  : php-pdo-5.3.3-48.el6_8.x86_64                              17/20 
  Verifying  : libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64                   18/20 
  Verifying  : php-xml-5.3.3-48.el6_8.x86_64                              19/20 
  Verifying  : php-bcmath-5.3.3-48.el6_8.x86_64                           20/20 

Installed:
  libjpeg-turbo-devel.x86_64 0:1.2.1-3.el6_5                                    
  libjpeg-turbo-static.x86_64 0:1.2.1-3.el6_5                                   
  libmcrypt.x86_64 0:2.5.8-9.el6                                                
  php-bcmath.x86_64 0:5.3.3-48.el6_8                                            
  php-gd.x86_64 0:5.3.3-48.el6_8                                                
  php-imap.x86_64 0:5.3.3-48.el6_8                                              
  php-ldap.x86_64 0:5.3.3-48.el6_8                                              
  php-mbstring.x86_64 0:5.3.3-48.el6_8                                          
  php-mcrypt.x86_64 0:5.3.3-5.el6                                               
  php-mysql.x86_64 0:5.3.3-48.el6_8                                             
  php-odbc.x86_64 0:5.3.3-48.el6_8                                              
  php-pear.noarch 1:1.9.4-5.el6                                                 
  php-xml.x86_64 0:5.3.3-48.el6_8                                               
  php-xmlrpc.x86_64 0:5.3.3-48.el6_8                                            

Dependency Installed:
  libXpm.x86_64 0:3.5.10-2.el6             libc-client.x86_64 0:2007e-11.el6    
  libtool-ltdl.x86_64 0:2.2.6-15.5.el6     libxslt.x86_64 0:1.1.26-2.el6_3.1    
  php-pdo.x86_64 0:5.3.3-48.el6_8          unixODBC.x86_64 0:2.2.14-14.el6      

Complete!

如果你漏装了,或者没有安装成功个别,可以这样子安装:

yum install php-mysql 插件的名称

好啦,搞定之后重启一下Apache吧!

service httpd restart

提示:

Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

OK,到这里的话,Apache、MySql、PHP就安装完了,接下来,我们测试一下能不能跑PHP程序。

进入网站目录:

cd /var/www/html

创建一个文件(touch info.php)插入内容(vi info.php)如下:

<?php
echo phpinfo();
?>

访问一下:

http://服务器的公网ip/info.php

%e5%b1%8f%e5%b9%95%e5%bf%ab%e7%85%a7-2016-11-13-06-41-55-1024x733

到这里的话,就安装成功了,其他需要的插件,请行脑补哈!

本文链接:http://blog.sunofbeaches.com/archives/523 转载请注明出处.
如果喜欢:点此订阅本站
7K
相关文章
为您推荐
各种观点

报歉!评论已关闭.