Monday, January 16, 2012

Ubuntu 11.10 - Managing your Ubuntu Server from terminal (as opposed to gui)

So recently I decided to upgrade my server from ubuntu 11.04 to 11.10 and as usual there were issues. This time around I was unable to install a gui (graphical user interface) without corrupting the operating system software. So I've had to learn how to do things from terminal.
So based on research online (and trial and error, to see what worked and what did not), I've come up with the following, which I plan to put all in one place (here) for future information. They are not complete, so information will be forthcoming as soon as I can find it:

  1. Logout, shutdown and reboot commands
  2. Detect your hardware
  3. Detect drivers / check device is switched on
  4. Software programs / packages:
    1. Load sudo aptitude interface
    2. Find out what programs are already installed
    3. Update / upgrade packages
      1. From terminal
      2. Via aptitude interface
    4. Install packages
    5. Remove packages
  5. Networking:
    1. Find out your servers ip address
    2. Download and install drivers for hardware / networking
    3. Edit network configuration file
    4. How to scan for wireless networks
1. to Logout / Shutdown / reboot:
to logout:
sudo exit
to shutdown:
sudo shutdown -h now
to reboot:
sudo reboot
2. to detect hardware:
sudo lspci
3. to detect drivers and check the device is switched on:
sudo lshw or sudo lshw -C network

4. Software Programs and Packages:
there are two ways within terminal to detect, update, install and remove software packages and programs. One way is to do so directly via terminal commands and the other is to open the aptitude interface and do so from there:
1. To open the aptitude interface:
sudo aptitude
2. To find out what programs / packages are installed already:
This can only be done from the aptitude interface (as far as I know), just use the arrow keys to select the "installed packages" option, then the "enter" key to open the list.
3. To update / upgrade packages:
first you need to update the package updates list, then you need to download and install the updates:
1. from terminal: sudo apt-get update or sudo apt-get upgrade
2. from aptitude interface: common "u" updates your package index in the "packages to be updated" group. Use arrow keys to highlight the specific group from the list, press the "enter" button to open up the list of packages, then for each package you want to update, press the capital U (shift+"u") to select the package and use arrow keys to highlight packages on the list (for each package you want to update, press capital "U" to select it). After you have selected all the packages you would like to update, press common "g". Then press common "g" a second time. Once all the packages are updated, the server may ask you to press the "enter" button to be taken back to the aptitude interface. To logout from aptitude, press common "q".

4. To install packages
There are two ways to install packages:
1. from terminal - sudo apt-get install [packagename] or sudo aptitude install [packagename] (where [packagename] is replaced by the package / file name you wish to install). for example, to make sure your server can zip & unzip files, you would enter sudo apt-get install zip unzip.
2. from the aptitude interface:
Coming Soon


5. to remove packages:
sudo apt-get purge remove [packagename]
sudo aptitude purge remove [packagename] where "[packagename]" is replaced by the package / file name you wish to remove.

5. Networking:
1. Find out your computer's/server's ip address:
1. for wired / cable / land line connection: sudo ifconfig - and where it says "inet addr:" the numbers immediately following are your ip address. This would look something like 123.456.7.89
2. for wireless devices: sudo iwconfig - and where it says "inet addr:" the numbers immediately following are your ip address. This would look something like 123.456.7.89
3. how to scan for wireless networks:
sudo iwlist wlan0 scan