CentOS 6.0 已经发布,但是不敢保证能安装顺利,还是先在CentOS 5.6 上安装,lighttpd是一个安全,快速,标准的Web服务器。本教程演示如何安装一台CentOS 5.6的web服务器与PHP5支持(通过的FastCGI)和MySQL支持lighttpd的。
1.初步说明
在本教程中我使用主机名server1.example.com,IP 地址 192.168.0.100 。这些设置可能会有所不同,所以你必须在适当情况下替换他们。
2,安装MySQL 5.0
首先,我们安装了MySQL 5.0,像这样:
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: <– 输入密码
Re-enter new password: <– 再输入一次密码
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 ~]#
3.安装Lighttpd
lighttpd不是从官方的CentOS 5.6库安装,而是从RPMForge软件库 【 Linux公社 】(详情见#B2的说明,) 。我们在安装RHEL 5,以及为CentOS 5.6 rpmforge的包:
如果你是x86_64系统安装:
wget
rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
如果你是一个i386系统安装:
wget
rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.i386.rpm
之后,安装lighttpd:
yum install lighttpd
然后,我们创建系统启动lighttpd的链接(在系统启动时lighttpd自动启动):
chkconfig --levels 235 lighttpd on
/etc/init.d/lighttpd start
如果lighttpd的启动失败并出现以下错误信息… …
(network.c.203) socket failed: Address family not supported by protocol