Wed 7 May 2008
Install CentOS in Parallels 3.0 is quite straight forward. Firstly, download the net install ISO from CentOS site. Parallels can directly using iso file mount as CD-ROM for booting up a new empty VM. During the wizard setup process, choose Linux, for distribution, although no CentOS in the list, since CentOS is based on Fedora, so choose Fedora is alright. In order for outside can access the VM as development server. Choose Bridged Ethernet in Wizard of Parallels.
Basic Installation
During the setup screen of CentOS, when come to step for how to install, please choose http, and enter mirror site domain as the website name, the URL path as the folder. Note: the URL may be different from downloading ISO, because this time you have to tell CentOS installer where the actual installation file located on the Internet. Usually, you parent up the mirror site directory, you will find a directory "os" for the files (e.g. website name: ftp.hostrino.com folder: pub/centos/5.1/os/i386/), the directory with a sub-directory "images" is the correct path you should input in the setup screen.
For choosing package. I have chosen "Server" and "Server GUI".
After CentOS installed, you can install the Parallels-Tools. Choose "Install Parallels Tools" in the Parallels menu bar. In CentOS command line type:
cd /media
sudo sh parallels-tools.run
Parallels Tools in only using in X-window, for better resolution support, move the mouse between VM window and MAC.
If you want to config X-window resolution in command line type:
To start X-window, type:
By default, Apache and PHP are installed (A guide for install Apache in Linux). You have to manually install MySQL. For most simple way. Choose Applications > Add/Remove Software in X-window, then install MySQL there.
FTP Server Installation
Then install FTP server, so that you can upload file to CentOS. I choose vsftpd. In command line, type:
yum install vsftpd. (A guide for install and config vsftpd in CentOS)
To start vsftpd, type:
Since it is a development server, no need config any user account. I just using root to login FTP through SSH2.
To make FPT server auto run when CentOS is startup or after reboot, type:
Auto start for Apache
CentOS doesnot auto start Apache, so you have to make it work when server is startup or after reboot, type:
To confirm Apache is running:
For daily development, if you want to restart Apache (e.g after edit /etc/httpd/conf/httpd.conf or /etc/php.ini), type:
Auto start for MySQL
CentOS does not auto start MySQL, so you have to make it work when server is startup or after reboot, type:
For daily development, if you want to restart MySQL, type:
Firewall Setting
This is the most important step. Firstly, you can type:
to know the internal ip address (e.g. 192.168.1.8) of CentOS. You may think type the ip in Safari to access the web hosted in VM CentOS. However, Safari cannot open the default Apache testing page. You may wonder is it Parallel problem, blocking it for promote its server VM product? In fact, it is the software firewall default not open port 80 in CentOS. You can edit the file by typing:
adding the following:
Restart it:
or
You can find more guide on config iptables here.
You may setup virtual host in apache for develeopment. The access the developement site in Safari through the domain name instead of VM internal ip. You can edit /etc/hosts of MAC. In terminal, type su to change to root.
<input password>
vi /etc/hosts
Add the following, e.g. domain is www.vcasmo.com, ip is 192.168.1.8
Install Necesscary Package for PHP
Some important module for PHP which CentOS does not configure in PHP by default, without re-configure PHP, you can type the following command to add mbstring:
yum update php php-gd
Disable SELinux
If you facing any PHP create/update/delete file permission problem. You have sure the folder is chmod 777, owner/group is apache already, why still exist permission problem. It may because CentOS by default enabled SELinux. You should disable it by editing /etc/selinux/config, change to:
then reboot the server.
Others' Reference

