本教程中使用的IP地址是192.168.0.100,主機名稱為Server1.example.com 這些設置可能會有所不同,妳需要根據不同情況進行修改。
CentOS 6.2下安裝MySQL
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 ~]#
CentOS 6.2下安裝Apache
3.安裝阿帕奇2
Apache2的是作為壹個CentOS的軟件包,因此我們可以直接用下面命令安裝它:
yum install /rpm/packages/RPM-GPG-KEY.dag.txt
x86_64系統:
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
在i386系統:
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
安裝phpmyadmin
yum install phpmyadmin
現在我們可以設置phpMyAdmin,了我們可以改變Apache的配置來讓phpMyAdmin不僅僅只能從localhost登錄。
vi /etc/httpd/conf.d/phpmyadmin.conf
配置
下壹步,我們從HTTP改變的phpMyAdmin的cookie來身份驗證:
vi /usr/share/phpmyadmin/config.inc.php
修改身份驗證
重啟阿帕奇
/etc/init.d/httpd restart
在地址欄輸入http://192.168.0.100/phpMyAdmin/:妳就可以訪問phpMyAdmin了。
phpmyadmin頁面
CentOS可以得到RHEL的所有功能,甚至是更好的軟件。但CentOS並不向用戶提供商業支持,當然也不負上任何商業責任。
如果妳要將妳的RHEL轉到CentOS上,因為不希望為RHEL升級而付費。當然,妳必須有豐富linux使用經驗,因此RHEL的商業技術支持對妳來說並不重要。但如果妳是單純的業務型企業,那麽還是建議妳選購RHEL軟件並購買相應服務。這樣可以節省妳的IT管理費用,並可得到專業服務。