Lessons Learned

I know that posting your mistakes on a portfolio is probably not considered a wise thing, but as I stated in my first blog post – I’m not exactly CLI/UNIX savvy. Well, let me tell you a story about what I did the other night.

I was getting sick of PHPMyAdmin kicking me out constantly, so I wanted to go into the config.inc.php file and set the cookie length to something higher. Well, Ubuntu was throwing a fit saying I didn’t have the permissions to save in that directory.

What did I do?

cd /etc/phpmyadmin
sudo chmod -R 0777 /

Yeah, that’s right. I set the permissions for my entire distro to global access, thinking I was going to recurse through my current working directory. This made Sudo extremely upset with me. I thought there was something I could do to redeem it. I was mostly concerned because I had started adding listener events into my application and I wanted to maintain that progress before I had to do anything drastic.

I couldn’t seem to do anything to repair the damage, so I had to reformat. Thank the open-source genies for including one of the most useful concepts I’ve ever even seen in the operating system world – Ubuntu’s Try It function. With this, I was able to snag my Vinticuffs folder and upload it to Dropbox. Then I reformatted, cloned my repo from GitHub and copied my archived files into it. Got back up and running quite quickly.

I’m quite impressed by the amount of time it took me to redeem such a terrible stupid mistake with UNIX. If this was Windows, I’d have probably still been installing my GFX drivers, updating Windows itself and going through the headache of installing all these different applications. Then again, I guess if I was using the Ubuntu machine as a main PC, I’d still be suffering from having to install my GIMP/IDEs/FTPs/Games, etc. At the same time though, I got my LAMP stack back up and running – apparently found some interesting mistakes as well within my original code (apparently some of my validation rules didn’t like not being in an array this time..?).

So it’s all up and running again. Here’s the shortcut ideology of how I went ahead and got back up and running in about 2 hours.

1.) Installed Ubuntu

2.) Installed LAMP

sudo apt-get install tasksel
sudo tasksel install lamp-server

3.) Installed PhpMyAdmin

sudo apt-get install phpmyadmin

4.) Installed SSH, so I can BASH from my PC

sudo apt-get install openssh-server

5.) Attempted to install MCrypt (required by Laravel, also it seems like it was installed come
this point – but hell I’ll do it anyways, lol)

sudo apt-get install php5-mcrypt

6.) Apache2 Mod_Rewrite

sudo a2enmod rewrite

7.) Recreated my Vinticuffs Apache site

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/vinticuffs
sudo a2dissite default && a2ensite vinticuffs

Mind you, by now – if you go to http://localhost in your web browser, you should be getting the normal LAMP welcome message by now. If not, then I might be able to help you. Give me another day of messing up my Ubuntu installation and I’ll totally master this.

8.) Edit your current site to point towards your directory. In this case, I’m using Laravel 4, Laravel 4 itself focuses on the /public/ directory for it’s content delivery. If you don’t point there, your members will get a generic index page where they’d have to select the public folder — and they also have slight access to your website’s structure.
sudo nano /etc/apache2/sites-available/vinticuffs

In this file, you want to change a couple of things
DocumentRoot should point at your current directory for the website, in my case it’s /home/username/public_html/vinticuffs/public
Change the second bracket of to the same path, this is the bracket section containing AllowOverride None.
While you’re at it, change AllowOverride None to AllowOverride All

9.) Install the configuration panel for Sambia and set it up if you’re working on a Windows machine.
Check out Richard Worloma’s tut, Share Files Between Windows 7 and Ubuntu 12.10 (Quantal Quetzal)

10.) We should be done with this, go ahead and reset your Apache server.

sudo /etc/init.d/apache2 restart

After this, I proceeded to install Git and cloned my repo – set up Git as needed and went ahead and overwrote my changes from the Dropbox back up and then pushed those changes.

Seems like I’m back up into working condition – so that’s all good.

Now back to focusing on developing Vinticuffs, currently working on some looping ideas that might help drive desire to be on the site. Hope it’s all successful!

If you stumble across this, and need a little bit of help with setting up LAMP or anything for web development, please ask – I’ll either try to help you, or point you in the right direction.

Ubuntu Testing Environment Set-Up

I’ve been using WAMP for local work for years now, but I want to be able to practice Shell commands and work in a proper UNIX server environment — so I’ve decided to set up a laptop that we rarely use around the house to use Ubuntu to have a better test station.

I downloaded Ubuntu 12.10 Desktop (would have went with server, but I actually want to play around with the OS since the last time I’ve used Ubuntu was like…v3?), got it installed and away we go.

First thing I did was went ahead an gave my Ubuntu machine a static IP address (in this case, 192,168.1.16), then I navigated to my workstation’s HOSTS file and input

192.168.1.16     root

This way I can browse to http://root/ to work with that machine, just like you’d use http://localhost/ for your client WAMP/XAMP/etc.

Opening Terminal, we need to download and install Apache/PHP/MySQL – I just went ahead an downloaded the full LAMP package.

sudo apt-get install tasksel
sudo apt-get install lamp-server

If you visit http://localhost on the “server” machine, you should pull up Apache’s default success page. Now, we’ll start to get away from being required to be on the actual machine and set up a SSH server so we can shell into it to do the rest of the work.

sudo apt-get install openssh-server

Since this is a localized testing server, you most likely don’t need to do much after this. If you want to though, you can edit the configuration file found at /etc/ssh/ssdh_config to look through your possible options for security and the sort.

Now, at this point. If you point to your server’s IP address on your client machine, you should be getting the same default Apache success message. Go ahead and load up PuTTY and input the server’s IP address and connect. Go ahead and input your server’s base username and password, and you should be free to continue.

From here, I went ahead and set chmod 777 on the www folder, since by default it wasn’t allowing me to save files into the folder. Enabled my mod_rewrite for Apache and headed forward with a localized testing server that has no limitations.

Now it’s time to head off and practice playing around with Laravel, ZendF, and Symfony!