Draw up an Ubuntu Server Environment

Ubuntu

Ubuntu Server is becoming a de-facto linux platform due to its frequent updates and wide adoption. This makes it one of the most simpliest to manage in Linux distributions. Other popular distributions include Debian (which ubuntu is built upon), Fedora, Suse. With cloud computing, you can launch an instance very easily. An instance is just like an empty hardware box, with the only difference of it being virtual. When you start off with a newly installed machine, lets see how we can set it up. We will focus on Ubuntu server edition here.

Choosing a version

For ubuntu, there are a few versions. It runs in twice a year release cycle, thus 10.04 (is around april) and 10.10 (is around october). So why are versions important? The release cycle keeps the basic packages updated. If you are running a server and is not looking to update your ubuntu installation every 6 months, use a LTS (Long Term Support). The LTS versions have a gap of about 2 years with 4 years support. 10.04 (Lucid) and 12.04 (Precise) is LTS versions as of writing.

Getting the basics up

Now we have a command prompt blinking in our face. What now? Type in the following.

> sudo apt-get update
> sudo apt-get upgrade

this will run loads of installs and type “y” for yes if you have to. After installing, reboot.

> sudo reboot

Now you need to setup your date time. there are other methods but this method adjusts and prevents time drift. You can make this more complicated via NTP daemon. Read this https://help.ubuntu.com/12.04/serverguide/NTP.html

> nano /etc/cron.daily/ntpdate

Enter this line if its not there, without the quotes! “ntpdate ntp.ubuntu.com”. Save and exit using ctrl-x.

> sudo chmod 755 /etc/cron.daily/ntpdate

setting local of system, which adds compilers to your server. Notice we use Sudo alot? Its meaning to run the command as the super user (Super User DO).

> sudo apt-get install build-essential

Change the default shell to bash
 
Nano is a great text editor that is simple and easy to use. You will need to frequently use ctrl+x to save and quit once you finish your changes. Here we use nano to edit the password file of your server. After entering the command below, find your username and change from bin/sh to bin/bash. For example:”myuser:x:1000:1001::/home/myuser:/bin/sh” to “myuser:x:1000:1001::/home/myuser:/bin/bash”

> sudo nano /etc/passwd

This command is to load the default shell as bash. Bash shell has more commands and is easier to use.

Installing Security Packages – ClamAV and NMAP

ClamAV is a general antivirus which is constantly maintained by public and a group of dedicated team. Kudos to them! To install and start a basic scan, enter in terminal and run,

> sudo apt-get install clamav
> sudo freshclam -r -i

There are a few methods to make clamAV a default daemon mode so you can invoke this via other applications. Mailservers can find this very useful. Another use is if you have upload folders.

NMAP is a port scanner to see if you have open ports

> sudo apt-get install nmap
> sudo nmap [IPAddress]

Installing UFW (Uncomplicated FireWall)
In command line, key in the following.

> sudo apt-get install ufw
> sudo ufw enable
> sudo ufw status
> sudo ufw logging on [this enables logging]
> sudo ufw allow ssh
> sudo ufw allow 80/tcp
> sudo ufw allow ftp
> sudo ufw allow smtp

To enable FTP to successfully go through your firewall, you might need to open certain ports. The example below opens from 20000 to 20999.

> sudo ufw allow ftps
> sudo ufw allow proto tcp from any to any port 20000:20999
> sudo ufw delete allow ftps [this is to delete a rule]
> sudo ufw status [this is to view the firewall]

Now reboot your machine. you can do this easily via command line below.

> sudo reboot

Using CHKROOTKIT

> apt-get install chkrootkit
> chkrootkit

Moving around Ubuntu Server 12.04

The following are places which are commonly accessed by admins
  • /etc/init.d/… – directory where all your application controls are stored
  • /etc/… – directory where your applications are stored
  • /var/www/… – directory where your web server html/php files are stored
  • /var/log/… – directory where your log files are stored
  • /home/…. – directory where home directory of your users are held
  • /etc/passwd – file which stores the password
  • /etc/shadow – file which I cant remember what this is for
  • /etc/group – file which shows how groups and users are defined for this system

Some nice Commands

  • if php5-cgi is installed, you can find the version of Php: php-cgi -v
  • copy command: sudo cp /mysource /mytarget
  • changes the permissions of the folder or file: chmod -R 777 myfolder
  • secure access into another machine: ssh asd@123.45.67.89
  • view memory usage: free -m
  • shows which group user mydomain is in: grep mydomain /etc/group
  • usermod -a -G adm demo
  • Top / ps -ef
  • vmstat 1 [si so is the swap]
  • crontab -e [to edit]
  • crontab -l [to list]
  • To find out if a file exists and create one if there isnt one: touch filename

References

  • Ref: https://help.ubuntu.com/community/InstallingSecurityTools
  • SECURE KEY GENERATION: ADMIN USER + PUBLIC KEY
  • http://cloudservers.rackspacecloud.com/index.php/Ubuntu_-_Setup
  • http://www.cyberciti.biz/faq/howto-linux-add-user-to-group/
  • http://www.kalzumeus.com/2010/12/12/staging-servers-source-control-deploy-workflows-and-other-stuff-nobody-teaches-you/


Top Home mirageglobe




Leave a Reply


Recent Posts
Extracting OVF from VMware ESXI 6.0 · Installing LMDE 2 Betsy · SSL Certificates and Encryption · Machine Learning with Spark · Installing Lubuntu in Virtualbox · Getting started with Docker · Ubuntu upgrade limited boot space · Top 10 Browsers Overview · Taovilla Oracle app beta built using meteorjs · Setting up Debian on VirtualBox · The HomeBrew doctor · Caffeine icon for ubuntu / lubuntu · Updating wordpress without FTP · Updating wordpress without FTP · Preinstalled Languages on mainstream OS · Reminisce of Xcom · Java install on Ubuntu · Display image as ASCII art · VirtualBox Resizing Lubuntu Guest Linux · Introducing Samurai · Macbook Pro Key mapping for Lubuntu · Common Apache Nginx commands · Refreshing Git versioned files · Basic Environments for Jira · Converting a hg mercurial to git repository · Long term domain name costs comparison · SVG Graphing · 2 ways to Php install on mac · Introducing Samurai and Installing Meteorjs to own server · Improving the speed of Linux Mint · SVG graphics with Javascript · FTP Clients for Mac OS X · Windows Apps on Mac · Programming Languages Compared · Hackers Natural Cure · Publishing on Ebooks · Editors such as SublimeText2 · Good Coding Practice · LMDE Linux Mint Debian Edition · Heroku Webapp · Hadoop Single node 32bit on 12.10 Mint XFCE · Tracing User Behaviour FRUBO · Installing Nginx on MacOSX · Installing Ruby on MacOS X · Turn off annoying compress outlook message · HTML5 Apps on Cordova PhoneGap with MacOSX · Choosing and using Latex · Reviewing Javascript World · Draw up an Ubuntu Server Environment · Draw up a Lightweight Mail Server · Draw up a Web Database · Php CMS and Frameworks · Drawing up a Web Service · Draw up a Virtual Cloud Server · Unlocking and Flashing your ZTE Blade · Pip error in Python with Homebrew · HomeBrew for OSX · Windows and Linux Desktop Security · TexMaker with Glossary on Mac · Quick way to OpenStack on Lubuntu · Ancient IT Dictionary · TeaTime for Basic Python · CVs and Jobhunting · Chinese Input on Linux Ubuntu · Research in Computer Science · Reviewing Applications on My Mac · Reviewing Applications on My Windows · Installing Windows XP · Installing wireless on Linux Ubuntu or Mint · Restoring an Amazon EC2 Backup · Mac Update PASV problem · Reviewing Green Computing · Consuming the Cloud Storage Space · Using Cherokee and WordPress Whine · Disabling Lubuntu Screensaver · Installing Lubuntu from USB drive · Searching for a Micro Mini CMS · ReStructuredText in Python · Rackspacecloud Vs Amazon · Hacking your old PSP · Attending Atlanta 55th MMM Conference · Smart devices for everyday use · Creative Programmers · Linux Settings · Embarking on Further Education · Machine Learning · Mac Tips – Viewing hidden files on desktop · Creating PDF files for free · Online Media for All · C# ASP Settings · SVN Git and Mercurial Versioning · Getting the last inserted id using datasets · Think Lucky and be Happy · AngieGallery Design · AceTravel Design · Letter to Mum · Prison Vs Work · Irish Daughter · Are you a carrot, an egg or a coffee bean? · Home Media Entertainment Setup · Collection of Interesting sites · Studying in London · Great Oriental eats in London · CMS Joomla, WordPress, Drupal compared ·

© 2017 · MirageGlobe · using zenifywordpress theme by www.dracoturtur.com ·
  · RSS Feed