Skip to content

Instantly share code, notes, and snippets.

@chrisdchristo
Last active December 29, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdchristo/7709421 to your computer and use it in GitHub Desktop.
Save chrisdchristo/7709421 to your computer and use it in GitHub Desktop.
101: Ubuntu Setup

101: Ubuntu Initial Setup

Updating & Upgrading

To start off with it is wise to to update aptitude, upgrade the system and finally auto remove any unneeded packages.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove

Issues

You might get upgrade issues with the libc6 packages and might need to downgrade them:

dpkg -i /var/cache/apt/archives/libc-bin_2.13-37_amd64.deb 
dpkg -i /var/cache/apt/archives/libc-dev-bin_2.13-37_amd64.deb 
dpkg -i /var/cache/apt/archives/libc6-dev_2.13-37_amd64.deb 
dpkg -i /var/cache/apt/archives/libc6_2.13-37_amd64.deb

Remove Non-required Services

Samba

This is a service for WIndows and Linux machines to talk to each other for printing services.

You do not need it, so remove it:

sudo apt-get remove --purge samba
sudo rm -rf /var/lib/samba

Pre Config

Hosts file

Open it up:

sudo nano /etc/hosts

and set it to this (where n1 is your subdomain):

127.0.0.1	localhost.localdomain localhost.com localhost mydomain.com n1.mydomain.com www.mydomain.com n1
::1		localhost ip6-localhost ip6-loopback
fe00::0		ip6-localnet
ff00::0		ip6-mcastprefix
ff02::1		ip6-allnodes
ff02::2		ip6-allrouters

Environment Profile

The global environment configuration file is located at /etc/profile. Ignore the bashrc files eveywhere.

Open it up:

sudo nano /etc/profile

Append some convenient aliases:

alias l="ls -la"

alias cc='cd /var/lib/tomcat7'
alias cstop='sudo /etc/init.d/tomcat7 stop'
alias cstart='sudo /etc/init.d/tomcat7 start'
alias crestart='sudo /etc/init.d/tomcat7 restart'
alias clog='sudo tail -f /var/lib/tomcat7/logs/catalina.out'

alias aa='cd /etc/apache2/'
alias astart='sudo /etc/init.d/apache2 start'
alias astop='sudo /etc/init.d/apache2 stop'
alias arestart='sudo /etc/init.d/apache2 restart'

When Java is installed add these lines:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_49
export JRE_HOME=/usr/lib/jvm/jdk1.7.0_49
export JAVA_OPTS="-Xmx1024m -Duser.timezone=UTC -Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8"

When Tomcat is installed:

export CATALINA_HOME=/usr/share/tomcat7
export CATALINA_BASE=/var/lib/tomcat7

Tomcat APR library path:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib

Local Profile

Anything you want to add for yourself specifically, add it to your local ~/.profile file.

nano ~/profile

Add a custom coloured PS1 shell:

PS1='\[\e[0;34m\][\t] \[\e[31m\]\u@\H\[\e[36m\]$PWD \[\e[32m\]>\[\e[0m\] '

Note that altering the global /etc/profile file's PS1 shell will always be overwritten by the individual users .bashrc PS1. Howver, every user's local .profile will overwrite their local .bashrc. So you must add your custom PS1 shell in your local .profile for every user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment