VirtualBox安裝建立CentOS虛擬系統(tǒng)配置其他文件
特別值得一提的是CentOS有很多值得學(xué)習(xí)的地方,這里我們主要介紹VirtualBox安裝中配置,包括介紹VirtualBox安裝等方面。CentOS社區(qū)的Linux發(fā)行版本被稱為CentOS Linux,由于使用了由RHEL的源代碼重新編譯生成新的發(fā)行版本,CentOS Linux具有與RHEL產(chǎn)品非常好的兼容性,并且與生俱來(lái)地?fù)碛蠷HEL的諸多優(yōu)秀特性。
最近需要配置一個(gè)php的環(huán)境,當(dāng)然windows也可以,不過(guò)還是選擇安裝一個(gè)CentOS,經(jīng)過(guò)很長(zhǎng)一段時(shí)間的摸索,終于配置完成了.VirtualBox安裝中配置CentOS 5.3+Apache+MySql5+php5
1.到http://www.virtualbox.org/下載***版的virtualbox[直接下載=>http://download.virtualbox.org/virtualbox/3.0.2/VirtualBox-3.0.2-49928-Win.exe].
2.到http://www.centos.org/下載iso文件[直接下載=>http://mirror.averse.net/centos/5.3/isos/i386/CentOS-5.3-i386-bin-DVD.iso].
3.VirtualBox安裝.
4.建立一個(gè)CentOS的虛擬系統(tǒng),并VirtualBox安裝操作系統(tǒng),按提示操作即可.
5.進(jìn)入系統(tǒng)后,選擇系統(tǒng)窗口的[設(shè)備->安裝增強(qiáng)包],載入VirtualBox安裝的增強(qiáng)包iso.
6.按[ctrl+alt+f1]進(jìn)入命令行界面,以root身份登錄.
7.運(yùn)行以下命令安裝增強(qiáng)包,即可成功安裝增強(qiáng)包.:
yum install kernel-devel
yum install gcc
ln -s /usr/src/kernels/2.6.18-92.1.18.el5-i686 /usr/src/linux
sh VBoxLinuxAdditions-x86.run
8.以下安裝apache,mysql,php:
yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
9.安裝php擴(kuò)展:
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
10.安裝apache擴(kuò)展:
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
11.啟動(dòng)mysql:
/etc/init.d/mysqld start
12.設(shè)置mysql的root密碼:
mysqladmin -u root password '你的密碼'
13.按[ctrl+alt+f7]切換到圖形界面.
14.配置apache多站點(diǎn),找到/etc/httpd/conf/httpd.conf,用文本編輯器打開(kāi),找到[#NameVirtualHost *:80],去掉前面的[#]號(hào).
15.找到[DirectoryIndex index.html index.shtml],增加一個(gè)[index.php].
16.在[/etc/httpd/conf.d]文件夾內(nèi)新建一個(gè)[vhosts.conf]文件,內(nèi)容格式如下(假設(shè)我要建立兩個(gè)站點(diǎn)http://www.yomeier.com/ / http://www.k2046.cn/),對(duì)應(yīng)的網(wǎng)站文件則應(yīng)放在[/var/www/yomeier]和[/var/www/k2046]目錄下.:
<VirtualHost *:80>
ServerAdmin xxx@live.com
DocumentRoot /var/www/yomeier
ServerName www.yomeier.com
AddDefaultCharset UTF-8
<Directory "/var/www/yomeier">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin xxx@live.com
DocumentRoot /var/www/k2046
ServerName www.k2046.cn
AddDefaultCharset UTF-8
<Directory "/var/www/k2046">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
17.打開(kāi)終端.
啟動(dòng)apache:/etc/init.d/httpd start
18.設(shè)置apache自啟動(dòng):
chkconfig --add httpd
chkconfig --level 345 httpd on
19.設(shè)置mysql自啟動(dòng):
chkconfig --add mysqld
chkconfig --level 345 mysqld on
20.修正centos在VirtualBox安裝里全屏?xí)r分辨率的問(wèn)題:
用文本編輯器打開(kāi)[/etc/X11/xorg.conf]
找到:
SubSection "Display"
Modes "1280x800" "800x600" #這里按屏幕需要改就可以了
EndSubSection完成!
【編輯推薦】