Ubuntu Web Development Server

|

This is a project I’ve been meaning to rewrite, as I get it going I’ll add screen shots and examples but for now I’ll work on the shell scripts

After installing base Ubuntu, set the root/sudo password so you can do installs cleaner.

After the below you will asked for the password of the account you created during install then you will be able set the root/sudo password.

sudo passwd
apt-get install openssh-server
service ssh restart

Now that you have root/sudo, type in “su” and type in the password, you’ll notice the $ changes to # after you are logged in.

apt-get update && apt-get upgrade && apt-get autoremove

This script will give you some basic information about your machine, keep the text file as you will need it later.

#!/bin/bash

clear

## create variables
sUser="$(id -u -n)"
nUid="$(id -u)"
sHostname="$(hostname)"
sIP="$(hostname -I)"

## Check for root
[ $nUid -ne 0 ] && { echo "Only root may run this script"; exit 1; }

rm -f MachineInfo.txt

echo "User Name: " $sUser > MachineInfo.txt
echo "User ID: " $nUid >> MachineInfo.txt
echo "Machine/Host Name: " $sHostname >> MachineInfo.txt
echo "Machine IP Address(es): " $sIP >> MachineInfo.txt
echo  >> MachineInfo.txt
echo "Unix Distribution & Version:" >> MachineInfo.txt
lsb_release -a >> MachineInfo.txt

Example of this bash script:

User Name:  root
User ID:  0
Machine/Host Name:  MyDevBox
Machine IP Address(es):  10.10.1.101

Unix Distribution & Version:
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.2 LTS
Release:	14.04
Codename:	trusty

Install ClamAV – Option

apt-get --assume-yes update && apt-get --assume-yes upgrade && apt-get --assume-yes autoremove
apt-get --assume-yes install clamav
# Update ClamAV virus definitions
sudo freshclam

Install Python – Optional

apt-get install python-dev python-pip python-setuptools build-essential
pip install --upgrade setuptools
pip install --upgrade csvkit

Install GIT – Optional

apt-get install git

Install LAMP (Linux Apache MySQL PHP)

During the install process below you will get prompted to create a root password

apt-get update && apt-get --assume-yes install lamp-server^ php5-mysql libapache2-mod-php5 libapache php5-mcrypt php5-cli php5-cgi php5-common php5-curl php5-dbg
sudo /etc/init.d/apache2 restart
php -r 'echo "nnYour PHP installation is working fine.nnn";'
Originally Posted on May 13, 2015
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.