So I have wanted to dabble in WordPress for a while now, I did a little default project a while back converting a DotNetNuke site over to WordPress to cut down on hosting costs, for that project I used XAMPP. Don't get me wrong, XAMPP is great, but if I was going to delve deeper I wanted to have a full dev environment (and it also gave me an excuse to try out Ubuntu 10.4 Lucid Lynx).
I didn't want to lock myself into Ubuntu though. If possible I wanted to still develop inside of Windows, just using Ubuntu for the server. Here is what I did:
- VirtualBox + Ubuntu 10.4 = Happiness.
http://www.ubuntu.com/getubuntu/download
http://www.virtualbox.org/wiki/Downloads
Yes, I tried Windows 7 Virtual Machines, but I found out really fast they have it locked down now to only Microsoft OS's, spank you very much.
Key step: when configuring the virtual servers network connection, choose "Bridged" so it will grab it's own ip address from the network.
I am not going to go into details of how to set this up as I won't with most of these items, google is your friend and this step was cake. I am sure the will work with VM server as well.
- Install LAMP.
https://help.ubuntu.com/community/ApacheMySQLPHP
This link has a metric f-ton of information (actual unit of measure), so bookmark this, you will be back often. I will leave it to the experts once again to tell you how to configure php, etc. I used sudo tasksel install lamp-server and then proceeded to the steps for "After installing MySQL" noting to comment out bind-address since I was using DHCP for my server.
- Install Webmin
http://www.webmin.com/download.html
Nice little front end config for apache, choose the Debian Package option in Ubuntu for those n00bs like me that didn't realize that.
- Install PHPMyAdmin through the Ubuntu Software Center, search install, done.
Once installed do these steps for your ip address:
http://forums.mysql.com/read.php?35,38653,253722#msg-253722
- (DON'T) Install MySQL WorkBench on your Windows 7 box:
http://dev.mysql.com/downloads/workbench/
Make sure to install 5.2+, 5.1 has nothing you need. 5.2 should be a major release not a minor upgrade as it has the server browser and query editor. The old tools have been abandoned I guess.
Test your connection, etc.
=======================
UPDATE:
http://www.heidisql.com/
Use this tool instead.
=======================
- Create Host Entries on Ubuntu and Windows 7:
http://en.wikipedia.org/wiki/Hosts_file#Content_and_location
Ubuntu you are after 127.0.0.1 www.sitename.com
Windows 7 you want UbuntuIPAddress (use ifconfig -a in a terminal) www.sitename.com
I recommend doing this before configuring apache to avoid errors.
- Setup your virtual hosts in Apache2:
http://www.debian-administration.org/articles/412
Plus some of the information in step #2. Not kidding here, you just have to read. The thing that screwed me up was that by default apache2 acts more like IIS6 than IIS7, meaning you would have to use different ports (80, 81, etc) to do multple sites, so read the link here first, but refer to the overall lamp install instructions in the apache section for some useful commands (such as the guy in this step forgets to mention you need to use "sudo" to enable/disable sites and restart apache. Also the directories in this article are dated, I created a public_html directory in my /home/UserName/Public/ directory and created a folder www.sitename.com under that so I can expand this to more sites later on by simply starting from #6 down.
The tool Webmin from #3 comes in handy here also, but I only found it useful for "read only" purposes just to double check my work.
Key step: After you have everything done and go to re-enable the site you will get an error message along the lines of "Virtual Hosts and NameVirtualHosts are not compatible", like I said the "default" for Ubuntu is using multiple ports, so in summation you have to disable the default site, change it's config to match the format you used for your site in this article (give it a ServerName, ServerAlias, etc), then re-enable it. When done you shouldn't have any config files that specify a port (*:80) and every site in sites-available should just specify * and use ServerName/ServerAlias. That one took me a while to figure out and I couldn't find it documented anywhere, you are welcome.
p.s. your default document should be index.php not index.html if you are going to be setting up WordPress and almost any other CMS on these sites.
- Setup sharing:
http://ubuntuforums.org/showthread.php?t=290653
I initially tried to do everything out of /var/www, which I ran into some issues. Sharing items in your public_html directory you created in #7 above though is easier. I shared the root so I could get at all of my sites as I add more. You will probably get a few errors here but I didn't run into a lot of problems with this one that weren't readily documented. Once again Google is your friend.
- Install WordPress:
http://wordpress.org/download/
I did this step entirely from Windows 7 to make sure I had everything perfect. I copied the files from the zip via the share, I renamed and edited my mysql connection in the wp-config-sample.php via editors/windows in the share, and created my database through the MySql Workbench installed on Windows 7 (phpmyadmin through the browser would work just fine also). I fired up the browser from Windows 7 and put in www.sitename.com, poof, a working wordpress install.
I am sure I missed a few details, and I have to say while Ubuntu Lucid Lynx is a lot better, you are still way to reliant on the terminal for it to be ready for prime time. Every time I come back to Linux I hope "this will be the version where I don't have to hit up the terminal", and every time it isn't, but I am a Windows person, of course I think no terminal is superior. I did my time on the Vax/VMS system in college and my first job, I just don't want to go back to that 15 years later (although I still have a soft spot for ISCA BBS, which is amazingly still around: http://www.iscabbs.com/).
However, now I can fire up my virtual Ubuntu, open up MySql and my editor of choice (currently Dreamweaver or Notepad++ for php, I am a n00b, suggest away), all from the comfort and safety of Windows 7.
However, now I can fire up my virtual Ubuntu, open up MySql and my editor of choice (currently Dreamweaver or Notepad++ for php, I am a n00b, suggest away), all from the comfort and safety of Windows 7.
This isn't as portable as other methods, but since I am using host file changes for my site names, deployment is going to be a breeze.
Total Hassle Factor: 7/10
Total Time Spent: 3 to 4 hours including posting the details, on/off over 2 days is why it is so scatter brained. I need to take better notes if I am going to post these, noted. I would bet it can be done in under an hour with this post.
My other weekend project was much more manly, but I am sick of looking at this computer right now, so it will have to wait. Suspense: It involves ladders and PVP pipe (huh huh, he said "pipe")
Should I be concerned that half of the links in this post were already "visited" by me?
ReplyDelete