Thursday, April 30, 2009

Ubuntu Tips - (Updated)

I like Ubuntu, and I collected some tips from the Internet when I encounter problems. I think you might be interested in them too.

Just record a few below:

  1. How To Use Proxy Server To Access Internet at Shell Prompt

    This is the 1st problem I met, since my machine can access the Internet only via a Proxy Server, so when I type something like:

    # apt-get install packagename

    It always give me an error, and cannot get anything updated or installed.

    So I just googled the Internet and found this post is really useful.

    Basically it's using http_proxy environment variable in Ubuntu or any Linux OS, and it allows you to connect text based internet session/application via Proxy Server. So just type the following command to set proxy server:

    # export http_proxy=http://yourproxyserverip:port/

    Also you can setup the proxy variable for all users. To setup the proxy environment variable as a global variable, edit /etc/profile file:

    # vi /etc/profile

    And the following line:

    export http_proxy=http://yourproxyserverip:port/

    If you would like to use password protected proxy server, please refer to the link here.

  2. How to install software package or find the package based on file?

    Sometime I need to install a new customized package from somewhere, it requires pre-install some other packages. Or when you try to compile some new software from source, system might tell you missing some files or library. I sure you will have some question, How do you install individual package on Ubuntu?

    And here are the answers:

    • Via Graphical User Interface

      Under main menu, select System, then select Administration and click on Synaptic Package Management. Type a query into the search, then select a package you think is relative to what you want, Click Install.

    • Via Command Shell

      - Start a Terminal windows (Konsole, xterm, or any other command line/bash shell interface)

      - Type

      sudo -s

      (sudo as in superuser do, su as in "switch user") to get administrative privileges to install software

      - Type your password if prompted.

      - Type
      sudo aptitude install packagename

      If you need to know the package name of your program. Type

      sudo aptitude search 'programname or filename'

      will yield search results for your package when you supply it to the terminal. Here is the "current state" flag for search results:

      • i — installed: successfully installed to system

      • c — config: package not installed, but configuration files remain

      • p — purged: package has no files on system

      • v — virtual: package does not exist, but another "Provides" it

      • B — broken: dependencies unresolved, fix required

      • u — unpacked: only files unpacked, not configured

      • C — half-configured: configuration failed, fix required

      • H — half-installed: removal failed, must be reinstalled

      - In some cases, it may automatically know which package you want, such as "sudo aptitude install firefox" Look on the package page of the Ubuntu distribution site.

      - If you are not sure of the name of the program you are trying to install, you can use tab completion to try and find it (most major distributions have it.) Simply type the first few letters of the package you want to install and hit tab once or twice. For example, type fire and then hit tab, it will bring up all packages that begin with fire; firefox will be one of them.

      - Wait for it to prepare to install the software package from the repository.
      If you are prompted whether or not to install, type "y". Next time if you would rather have it do it automatically, type

      sudo aptitude install package -y

      Wait for it to finish installing, and close the terminal.

      - Another small tip is to update your software packages list by using the following command:

      sudo aptitude update

      - It should be in the Main Menu under the appropriate category. If not, restart your computer.

  3. How to Change the Computer Name?

    Open you terminal window and type the following command:

    sudo gedit /etc/hostname

    When prompted, enter the administrator password and click the OK button. The hostname file will open, displaying the current computer name. Replace the current computer name with the desired new name. Save the new file and Close all open windows and restart your system.

No comments :

Post a Comment

Comments System

Disqus Shortname