background image
HomeRecent PostsDrupalSearchTagsRSSContactAboutAccount
Eric.London's picture

After losing my development virtual machine yesterday, I thought I'd document my process for creating a new one. The first thing to do is download your favorite Linux distribution. I prefer Centos (RHEL without the support contract) but what's most important is creating one that's as close to your production environment as possible (to avoid package version differences, differences in documentation, and deployment issues). The second step is creating a new virtual machine and defining it's properties. For a basic development system, I give it 512MB of RAM and a large enough hard drive for your projects. After defining it's properties, point the CDrom drive at your downloaded Linux distribution ISO and install the operating system. Here's the fun part, getting everything to work...

Update your packages

$ yum update

Install your favorite text editor

$ yum install emacs

Configure sudo so you don't have to use root (in: /etc/sudoers)

%wheel ALL=(ALL) NOPASSWD: ALL

Create a new user for yourself, and set your new password

$ adduser Eric
$ passwd Eric
# NOTE: add your user to the wheel group in /etc/group so you can setup sudo
# NOTE: add your user to the apache group and vice versa
# NOTE: from now on, log in as your user and use sudo to execute commands that require root privileges

Install subversion

$ sudo yum install subversion

Install mysql

$ sudo yum install mysql-server

Install PHP

$ sudo yum install php php-cli php-common php-devel php-gd php-ldap php-mbstring php-mssql php-mysql php-odbc php-pear php-soap php-xml php-xmlrpc
# NOTE: The previous command will automatically install Apache (httpd) as a dependency

(OPTIONAL) upgrade PEAR packages

$ sudo pear upgrade-all

(OPTIONAL) install additional PEAR packages

$ sudo pear install DB HTML_QuickForm Mail Mail_Mime

(OPTIONAL) install openssl for HTTPS traffic

$ sudo yum install mod_ssl openssl

Set run levels for mysql and apache to ensure the services start automatically

$ sudo /sbin/chkconfig --level 2345 httpd on
$ sudo /sbin/chkconfig --level 2345 mysqld on

Set MySQL passwords

# root password:
$ /usr/bin/mysqladmin -u root password 'YOUR-NEW-PASSWORD'

# your user:
$ mysql -u root -p
mysql> grant all privileges on *.* to 'Eric'@'localhost' identified by 'YOUR-NEW-PASSWORD' with grant option;

# (OPTIONAL) you can add privileges for your user to connect from other computers:
mysql> grant all privileges on *.* to 'Eric'@'%' identified by 'YOUR-NEW-PASSWORD' with grant option;

Configure PHP (edit /etc/php.ini)

$ sudo emacs /etc/php.ini
display_errors = [Off per prod | On per dev/test]
error_reporting = E_ALL & ~E_NOTICE
memory_limit = 100M
upload_max_filesize = 100M
post_max_size = 100M

Configure Apache

# create a directory for all your vhosts, and set permissions
sudo mkdir /var/www/vhosts
sudo chown -R Eric.Eric /var/www/vhosts
sudo chmod -R 2770 /var/www/vhosts

# create a new configuration file to keep your changes separate from httpd.conf
$ sudo emacs /etc/httpd/conf.d/Eric.conf

# FILE CONTENTS - START

# set directory indexes to ensure php files are not read as text
DirectoryIndex index.php index.html index.html.var index.htm

# enable name based virtual hosts, so you can host multiple hostnames on one server
NameVirtualHost *:80

# I create a separate directory for all my virtual hosts. This allows .htaccess files to work properly
<Directory /var/www/vhosts>
AllowOverride All
</Directory>

# add your first virtual host entry
<VirtualHost *:80>
ServerName SITEHOSTNAME
DocumentRoot /var/www/vhosts/SITEHOSTNAME/httpdocs
ErrorLog logs/SITEHOSTNAME-error_log
CustomLog logs/SITEHOSTNAME-access_log common
</VirtualHost>

# FILE CONTENTS - END

Configure MySQL (edit /etc/my.cnf)

[mysqld]
set-variable = max_allowed_packet=32M

Start Apache & MySQL

$ /etc/init.d/mysqld start
$ /etc/init.d/httpd start

(OPTIONAL) Configure Samba so you can edit your virtual machine filesystem from your host operating system
[documentation here]

Now, from your host operating system, edit your /etc/hosts file and point your development hostname to the new IP address of your virtual machine. If you go to that web address you should be able to reach your Apache virtual host on your new virtual machine!

Here's an (incomplete) list of the software and tools I prefer to use:

Internet Browsing
I use Firefox3 as my primary browser. Here are some of the extensions I have installed:
- Colorzilla - allows you to pick a color from a website
- Delicious Bookmarks - allows me to access, create, and search my bookmarks wherever I go
- DownloadHelper - allows you to download embedded flash. movies, objects, etc
- Firebug - the BEST tool for web development. GET IT NOW
- FireFTP - a FTP client that fits nicely into a tab in FireFox
- MeasureIt - allows you to measure distances on a website
- Web Developer - another essential tool for web development
- YSlow - a Yahoo! plugin used to evaluate and analyze page load times
I also use the following browsers for testing web apps: Safari, Flock, Camino, Opera, & ies4osx. IES4OSX allows you to install Internet Explorer on a MAC using Wine for OSX, sweet!

Development
I run OSX as my primary operating system. An operating system is useless to me if it doesn't have a fully functional shell. I use Parallels to install a Centos virtual machine (with no GUI). Centos is used to run LAMP and any other development and application services. I then connect to my linux filesystem using Samba and SSH. I use Eclipse as my primary IDE (with the PDT plugin for PHP). For database management I use Navicat and MySQL Tools. For a Subversion client I use Versions.

Other
- Quicksilver - file/application indexing to increase productivity
- Adobe Photoshop CS3 - image creation and manipulation
- Aquamacs Emacs - text editor
- FFMPEGX - video conversion
- Fugu - secure file copy
- Google Notifier - email and calendar event reminders
- IPSecuritas - VPN Connections
- Skype - Office chats, video conferencing, IMs
- iChat - IMs & video chats
- iTunes - I listen to music all day long off my iPod
- NeoOffice - OpenOffice for OSX (FREE equivalent of M$ Office)

Syndicate content