跳转到路径导航栏
跳转到正文内容

应用体验 CentOS 6.2下搭建Web服务器

http://www.sina.com.cn  2012年03月19日 10:35  中关村在线微博

  作者:赵为民

  如今,Linux在Web应用越来越广,许多企业都采用Linux来搭建Web服务器,这样即节省了购买正版软件的费用,而且还能够提高服务器的安全性。

  之前我们介绍了如何在openSUSE 12.1下搭建Web服务器,里面详细介绍了在openSUSE 12.1下搭建服务器的方法,其实除了Red Hat和openSUSE,CentOS也是人们经常用到的搭建Web服务器的Linux版本。


Centos搭建web服务器
CentOS 6.2下搭建Web服务器

  CentOS是企业Linux发行版领头羊Red Hat Enterprise Linux(以下称之为RHEL)的再编译版本,RHEL是很多企业采用的linux发行版本,需要向RedHat付费才可以使用,并能得到付过费用的服 务和技术支持和版本升级。这个CentOS可以像REHL一样的构筑linux系统环境,但不需要向RedHat付任何的费用,同样也得不到任何有偿技术 支持和升级服务。

  由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。所以这里给大家介绍一下如何在CentOS6.2下与Apache 2、PHP5、MySQL搭建Web服务器,希望对一些人有帮助。

  1.开始说明

  本教程中使用的IP地址是192.168.0.100,主机名称为Server1.example.com 这些设置可能会有所不同,你需要根据不同情况进行修改。


  2.开始安装MySQL5

  首先我们应该先用下面的命令安装MySQL:

   yum install mysql mysql-server

  然后我们需要创建MySQL系统的启动键链接启动MySQL服务器,这样以便于MySQL在系统启动时自动启动

   chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

  为MySQL root帐户设置密码:

  mysql_secure_installation

  会出现下面的一系列提示:

  root@server1 ~]# mysql_secure_installation

    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):

    OK, successfully used password, moving on.。。

    Setting the root password ensures that nobody can log into the MySQL

    root user without the proper authorisation。

    Set root password? [Y/n] <-- ENTER

    New password: <-- yourrootsqlpassword

    Re-enter new password: <-- yourrootsqlpassword

    Password updated successfully!

    Reloading privilege tables。。

    ... Success!

    By default, a MySQL installation has an anonymous user, allowing anyone

    to log into MySQL without having to have a user account created for

    them. This is intended only for testing, and to make the installation

    go a bit smoother. You should remove them before moving into a

    production environment。

    Remove anonymous users? [Y/n] <-- ENTER

    ... Success!

    Normally, root should only be allowed to connect from 'localhost'. This

    ensures that someone cannot guess at the root password from the network。

    Disallow root login remotely? [Y/n] <-- ENTER

    ... Success!

    By default, MySQL comes with a database named 'test' that anyone can

    access. This is also intended only for testing, and should be removed

    before moving into a production environment。

    Remove test database and access to it? [Y/n] <-- ENTER

    - Dropping test database.。。

    ... Success!

    - Removing privileges on test database.。。

    ... Success!

    Reloading the privilege tables will ensure that all changes made so far

    will take effect immediately。

    Reload privilege tables now? [Y/n] <-- ENTER

    ... Success!

    Cleaning up.。。

    All done! If you've completed all of the above steps, your MySQL

    installation should now be secure。

    Thanks for using MySQL!

    [root@server1 ~]#

上一页 1 2 下一页

分享到:

本文相关下载

更多>> 
CentOS Linux 6.2
CentOS Linux主要面向那些需要企业级操作系统稳定性的人们。

新浪简介About Sina广告服务联系我们招聘信息网站律师SINA English会员注册产品答疑┊Copyright © 1996-2012 SINA Corporation, All Rights Reserved

新浪公司 版权所有