Skip to content

Instantly share code, notes, and snippets.

@jeremyvaught
Last active December 31, 2015 13:29
Show Gist options
  • Save jeremyvaught/7992775 to your computer and use it in GitHub Desktop.
Save jeremyvaught/7992775 to your computer and use it in GitHub Desktop.
My notes on installing Ubuntu 13.10 Server in VirtualBox on my Mac. Also, this is not intended to be an actual shell script, just a list of commands to copy and paste
# ... pre-writing it down, but basically install the OS
# then update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
# Ubuntu comes with tasksel, so going with that
sudo tasksel # choose openSSH server and LAMP, Basic Ubuntu Server will have already been chosen. These can also be chosen during the install process but I found it may make for a less smooth install process
# So I can install the iso and other things into the future
sudo apt-get install build-essential
# download iso cuz mounting it is a giant pain
wget https://www.dropbox.com/s/le7xklq8o7cb0yn/VBoxGuestAdditions.iso
# mount iso
sudo mount -o loop ~/VBoxGuestAdditions.iso /media/cdrom
# run it
sudo /media/cdrom/VBoxLinuxAdditions.run --nox11
# Set up Ports
ifconfig # Look for inet addr, in my case it's always been 10.0.2.15
#In VirtualBox Machine->Settings->Network under Adapter 1: NAT: Port Forwarding: +
#http TCP 127.0.0.1 8888 10.0.2.15 80
#ssh TCP 127.0.0.1 2222 10.0.2.15 22
# Check http://localhost:8888/ in your browser you should get a It Works!
# At this point I reboot and switch to sshing in with
ssh localhost -p 2222 -l jeremyvaught #use the username you installed with of course
#also there are ways to make it passwordless but I haven't messed with that as of yet
# Some odds and ends
#json and compposer
sudo apt-get install php5-json # Because the licensing if json says to not do evil, and Richard Stallman wants to
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer #install composer universally
#mcrypt
sudo apt-get install php5-mcrypt
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
#modrewrite
sudo a2enmod rewrite
ls -al /etc/apache2/mods-enabled/rewrite.load
sudo vim /etc/apache2/apache2.conf
#change all `AllowOveride None` to `AllowOverride All`
sudo service apache2 restart
# Possibly ...
sudo apt-get install git
mkdir /var/www/test
cd /var/www/test
git clone https://github.com/laravel/laravel.git .
composer update
# Now is browser go to http://localhost:8888/test/public/ and you should have arrived
# Mount local projects
# In VirtualBox Machine->Settings->Shared Folders: +: Location on Mac, Give it a name, I chose Sites: check auto mount and make permanent
sudo mv /var/www /var/www.bak
sudo mkdir /var/www
sudo chmod 777 /var/www
sudo mount -t vboxsf -o uid=1000,gid=1000 Sites /var/www
sudo adduser jeremyvaught vboxsf
#reboot
sudo usermod -a -G www-data jeremyvaught
sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
sudo vim /etc/rc.local
#above exit 0
#this didn't work #sudo mount -t vboxsf -o uid=1000,gid=1000 Sites /var/www
sudo mount -t vboxsf -o uid=33,gid=33,umask=0022 Sites /var/www
# Adding self signed SSL
# so far basing this info on https://help.ubuntu.com/13.10/serverguide/certificates-and-security.html
openssl genrsa -des3 -out server.key 2048
openssl rsa -in server.key -out server.key.insecure
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
sudo cp server.crt /etc/ssl/certs
sudo cp server.key /etc/ssl/private
######################################################################################################################
################# Below here I'm experimenting with, probably shouldn't follow these directions. heh #################
######################################################################################################################
# Configure Apache for SSL, based on http://www.unixmen.com/install-apache-ssl-ubuntu-13-10/
# I did a bunch of stuff below and no workey, came back and tried this sudo apt-get install apache2-utils, still no workey, but needs mentioning
# also tried http://d.klwe.info/ubuntu-12-04-setting-up-apache2-and-ssl-with-self-signed-certificate/, no bueno
a2enmod ssl
sudo service apache2 restart
sudo vim default-ssl.conf
#and put in the file
<VirtualHost *:443>
ServerAdmin webmaster@localhost
#ServerName *:443
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
</VirtualHost>
#back in the command line
a2ensite default-ssl
service apache2 reload
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment