Setup CentOS in Parallels as Development Server in MAC

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:
mount /dev/hdb /media
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:
system-config-display --reconfig

To start X-window, type:
startx

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:
/etc/init.d/vsftpd start

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:
chkconfig vsftpd on

Auto start for Apache

CentOS doesnot auto start Apache, so you have to make it work when server is startup or after reboot, type:
chkconfig --level 235 httpd on

To confirm Apache is running:
chkconfig --list httpd

For daily development, if you want to restart Apache (e.g after edit /etc/httpd/conf/httpd.conf or /etc/php.ini), type:
service httpd restart

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:
chkconfig --levels 235 mysqld on

For daily development, if you want to restart MySQL, type:
service mysqld restart

Firewall Setting

This is the most important step. Firstly, you can type:
ifconfig 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:
vi /etc/sysconfig/iptables
adding the following:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Restart it:
/etc/init.d/iptables restart or service iptables restart
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.
su
<input password>
vi /etc/hosts

Add the following, e.g. domain is www.vcasmo.com, ip is 192.168.1.8
192.168.1.8 www.vcasmo.com

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 install php php-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: SELINUX=disabledthen reboot the server.

Others’ Reference

Make MacBook BootCamp WinXP Can Detect and Connect Wiimote

Using Leopard DVD updated to BootCamp 2.0, bluetooh can detect Wiimote, but cannot connect to Wiimote. Therefore, even running WiiFlashServer, it show error that cannot find any Wiimote. I read other people suggest using BlueSoleil. Download and installed, found it cannot support Apple bluetooth. After that, at Apple Forum found this article, follow the instruction to do, finally, MacBook BootCamp WinXP can detect and connect Wiimote.

Solve the Problem of Dreamweaver 8 Cannot Save FTP Login and Password

This problem has affected me for a long time. I use Dreamweaver 8 Manage Sites to synchronize the local file and remote file of the site. Although I save FTP login and password every time, when Dreamweaver is closed, next time, re-open it again, FTP login and password is lost! Google the solution, find it is caused by damn IE7, to solve the problem, quickly download 8.0.2 Updater.