Setting up a new dev environment
There are so many things i forget when setting up a new workstation. This time I took notes so I wont forget.
After installing VMWare fusion3 on my macbook pro I download the latest Ubuntu iso and start a new VM with it. I keep my work on TrueCrypt partitions. Then work my way down this list.
For starters
-
sudo apt-get install git-core gitk git-gui
-
sudo apt-get install subversion
-
sudo apt-get install ssh-client
-
sudo apt-get install ssh-server
-
sudo apt-get install vim
-
sudo apt-get install rake
-
sudo apt-get install libxml2-dev
Then install sphinx
http://freelancing-god.github.com/ts/en/installing_sphinx.html
./configure, make, sudo make install
VMWare Tools
Turn off shared folders (i always get failures when i dont)
From the virtual machine menu, select install VMTools. Open the virtual DVD and put the zip file on the desktop and extract it there.
From a terminal cd Desktop/vmware…
Then sudo ./vmware-tools-install.pl
Enter key for all the defaults. Then run the networking stop and start commands at the end of the instructions.
Install Ruby
-
sudo apt-get install ruby-full build-essential
or
-
sudo aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev
Install Apache
-
sudo apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev
Install Ruby Gems
-
sudo apt-get install rubygems
-
export PATH=/var/lib/gems/1.8/bin:$PATH
Install Rails
-
sudo gem install rails
Install MySQL
-
sudo apt-get install mysql-server mysql-client
-
sudo apt-get install libmysql-ruby libmysqlclient-dev
-
sudo gem install mysql
Install Passenger
-
sudo gem install passenger
-
sudo apt-get install apache2-threaded-dev libapr1-dev libaprutil1-dev
-
sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module
[follow passenger instructions]
VMWare Network connections
Since FF is the default browser you need to make a small change to browse the web.
Open FF and put about:config in the URL. Then filter for ipv6 and set false to true and restart FF. You should be online.
Shared Folders
Use TrueCrypt to keep your work on and share /Volumes/[your TC Drive] with VMWare. You will need to shift+apple+g to get the got to folder dialogue to find /Volumes.
You can access the files in your VM here
/mnt/hgfs
Install Gems
[what ever gems you need ]
Configure Apache
(Sill on your VM)
-
mkdir ~/rails_development
-
cd ~/rails_development
-
ln -s /mnt/hgfs/[your drive]/myapp myapp
Now cd to /etc/apachec2/sites-available and sudo scp 000-default myapp
then sudo vim myapp
-
-
<VirtualHost *:80>
-
ServerName myapp.ubuntu
-
RailsEnv development
-
DocumentRoot /home/wylie/rails_development/myapp/public
-
<Directory /home/wylie/rails_development/myapp/public>
-
AllowOverride all
-
Options -MultiViews
-
</Directory>
-
</VirtualHost>
-
Then cd ../sites-enabled
and sudo ln -s ../sites-available/myapp
then sudo rm 000-default
Finally restart apache
Set your hostfile
(Back on OS X)
get the IP in your VM and edit your hosts file on OS X
sudo vim /etc/hosts
[ip of VM] myapp.ubuntu
then run dscacheutil -flushcache (i usually have to run this a few times for it to take)
Install the DB
create any databases you need for your apps
Dont’ forget the memcached
-
sudo apt-get install memcached
-
sudo /etc/init.d/memcached restart
Fire it up
open your browser and go to myapp.ubuntu
Permission fixes
if you put id in the command line in your VM you will see that UID is 1000. The problem is that VMWare puts you in as UID 501 and GID 20. We need to update Ubuntu to match
sudo vim /etc/passwd
Then find your user and change 1000:1000 to 501:20, save and exit
You wont be able to make any more changes so you need to reboot. You cant log in either so you need to Ctrl + Alt + f1 to switch to terminal. Login there.
Then, you need to cd to /home and change the permissions on everything in your user dir like this
sudo chown -R 501:20 wylie
Then you need to update the group file sudo vim /etc/group
find dialup and change that to wylie [your username]. Then you need to find your username and change 1000 to 20.
sudo reboot, login and permissions are now fixed. Its a good idea to update your apache in /etc/apache2/envars. Change www-data to your username in both places
Git GUI fixes
The text in the UI is huge so you can open synaptic package manage and search for tcl. mark the 8.5 version for install. Then search for the tk8.5 and mark that for instalation. Then in command line
sudo update-alternatives –config wish
select the option with 8.5. It should be number 3.
Now when you open git gui it should look normal
Now get to work…
Hey, thanks for the tip on fixing gitk. This has been driving me crazy.