Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Ubuntu Web Development Server

Posted on May 13, 2015October 26, 2015 By David Kittell

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.

Related

Code UNIX Shell Scripts

Post navigation

Previous post
Next post

Related Posts

PowerShell Download Latest WordPress Plugin

Posted on September 17, 2015

This script will call out to a defined URL to check the version of a plugin and download the update if needed. To use: # Download only (if web is newer) #powershell -file DownloadLatestWordPressPlugin.ps1 <WordPress URL> <WordPress Plugin Version Installed> <Download Path> powershell -file DownloadLatestWordPressPlugin.ps1 https://wordpress.org/plugins/akismet/ 3.1.3 c:usersdkittelldesktopdownload # Download…

Read More

Remove Last N Characters From Column

Posted on September 9, 2015

Recently in a project to list all the plugins in a WordPress site with their versions I had accidently added .0 on to various rows in error. This script was very helpful to correct this error SELECT [id], [siteid], [pluginid], [versioninstalled], LEFT([versioninstalled], LEN([versioninstalled]) – 2), [Activated] FROM [Documentation].[dbo].[tblWP_SiteToPlugin] WHERE RIGHT([versioninstalled],…

Read More

Latin1_General_CI_AS Error

Posted on August 8, 2013October 26, 2015

Error: Cannot resolve the collation conflict between “Latin1_General_CI_AS” and “SQL_Latin1_General_CP1_CI_AS” in the equal to operation. When you run into this error simply add “COLLATE Latin1_General_CI_AS” after the column name(s) that you are selecting or comparing and it will work. SELECT MemberID COLLATE Latin1_General_CI_AS FROM UserTable Originally Posted on August 8, 2013Last…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes