Friday 20 January 2012

Advanced Packaging Tools



Advanced Packaging Tool, which has since been ported by Conectiva for use with rpm and has been adopted by several other distributions. The command apt-get is a powerful command line tools that are used to working with Ubuntu's Advanced Packaging Tool (APT) performing such functions as installation package of new software, upgrade software packages available, updating the list packet index, and even improve the entire Ubuntu system.

APT uses a file that lists the 'sources' from which packages can be obtained. This file is / etc / apt / sources.list.



The entries in this file follows this format

deb http://host/ubuntu distribution section1 section2 section3
deb-src http://host/ubuntu distribution section1 section2 section3 

The first word on each line, deb or deb-src, indicates the type of archive: whether it contains binary packages (deb), that is pre-compiled packages that we normally use, or source packages (deb-src), now we will see commands available for apt-get

Update list of available packages

Packaging systems use private databases to track the package installed, which is not attached and are available for installation. The program apt-get uses this database to find out how to install packages requested by the user and to determine the additional packages needed for the selected package to work properly.

sudo apt-get update

The following options to apt-get may be useful

-H This help text.
-D Download only - DO NOT install or unpack archives
-F Attempt to continue if the integrity check fails
-S No-act. Perform ordering simulation
-Y Assume Yes to all questions and do not encourage
-U Show a list of upgraded packages as well

Installing Packages Using apt-get

sudo apt-get install packagename

Example

sudo apt-get install apache2

Using apt-get package re-

If you somehow damage an installed package, or just want a file from a package that will be reinstalled with the latest version available, you can use the - reinstall option
sudo apt-get - reinstall install packagename
sudo apt-get - reinstall install apache2

Delete Using apt-get package

sudo apt-get remove packagename

Example

sudo apt-get remove apache2

Running apt-get as above will cause packets to be deleted, but their configuration files, if any, will remain intact on the system. For a complete removal of the package

sudo apt-get - purge remove packagename

Example

sudo apt-get - purge remove apache2

As in the case of installation methods, you can use a symbol with remove to invert the meaning for a particular package. In the case of moving, if you add a '+' right after the name of the package, the package will be installed instead of removed.

sudo apt-get - purge remove packagename +

Example

sudo apt-get - purge remove apache2 +

Upgrade Package

You can use this command to upgrade packages in the same distribution, as well as to upgrade to a new distribution

sudo apt-get-u upgrade

Upgrades to new releases

sudo apt-get-u dist-upgrade

If you want to upgrade a specific package using the following command

sudo apt-get-u install packagename

Example

sudo apt-get-u install apache2

Remove unused package files

When you install a package APT takes the necessary files from the hosts listed in / etc / apt / sources.list, stores them in a local repository (/ var / cache / apt / archives /), and then proceed with the installation. Within the local repository can grow and occupy a lot of disk space. Fortunately, APT provides tools for managing a local repository.

apt-get clean removes everything except lock files from / var / cache / apt / archives / and / var / cache / apt / archives / partial /. So, if you need to reinstall a package APT should retrieve again.

sudo apt-get clean

apt-get autoclean only removes package files that are no longer available for download.

sudo apt-get autoclean

Find a specific packge

If you want to find a specific packge using the apt-cache. This program is used by the APT system to maintain its database.

Search for specific package

sudo apt-cache search packagename

Example

sudo apt-cache search atari

If you want to get more information about a specific package using the following command

sudo apt-cache show packagename

Example

sudo apt-cache show nagios3

If you want to know what packages it depends on the particular package

sudo apt-cache depends packagename

Example

sudo apt-cache depends nagios3

How to find which package the file belongs

If you want to install a package, and you can not find what is called by searching with apt-cache, but knowing the file name of the program itself, or another file name that is owned by the package, then you can use apt-file to find the package name . This is done like this:

sudo apt-file search filename

You also can list the contents of a package, by running

sudo apt-file list packagename

apt-file that stores the database file that contains all the packages, such as auto-apt does and needs to be up-to-date. This is done by running:

sudo apt-file update

Downloading source packages

To download the source package, you will use the following command:

sudo apt-get source packagename

This will download three files: a. Orig.tar.gz, a. Dsc and. Diff.gz. In the case of packages made specifically for Ubuntu, the latter is not downloaded and the first usually will not have the "original" in the name.

The. Dsc file used by dpkg-source to unpack the source package into the directory packagename-version. In each downloaded source package there is debian / directory that contains the files needed to create. Deb package.

To automatically build the package when it is downloaded, just add-b to the command line

sudo apt-get-b source packagename

Packages required to compile a source package

Typically, specific headers and shared libraries need to be present so that the source package to be compiled. All source packages have a column in their control file called 'Build-Depends:' that indicates additional packages needed for the package to be built from source. APT has a simple way to download these packages.

sudo apt-get build-dep package

Example

sudo apt-get build-dep GMC
Share:

Tuesday 17 January 2012

NTP Linux Server



In general, the Network Time Protocol (NTP) is a protocol for synchronized to the system time on the computer to the source (server). There are several sites NTP "Stratum 1" (NTP sites with resources from the atomic clock time) and "Stratum 2" (NTP sites with NTP time sources from other sites, with a slightly reduced level of accuracy) that can be used by the public. However I will make how to make ntp local server, so no need for internet access. It's easy:


Share:

Saturday 14 January 2012

Proxy Transparant Linux Debian


Login root first before installing anything on our debian system. Install with the command:
      # apt-get install squid

After that you can configure it with the command
     # nano / etc / squid / squid.conf

search the files below and replace
              visible_hostname replace with your domain name
              cache_mgr contents of the e-mail to web master
              http_port 3128 transparent
              always_direct allow all
              cache_dir ufs / var / spool / squid 500 16 256
             

(For Access Control List)
acl lan src (IP / mask)
acl block dstdomain. google.com. facebook.com
word url_regex acl-i "/ etc / squid / word.txt" (for the word "the want on the block: eg women)


(moved under INSERT YOUR OWN)
http_access allow lan
http_access deny block
http_access deny word
           
Then create the cache directory by typing:
      # squid-z

Run the IP Forwarding:
      # echo 1> / proc/sys/net/ipv4/ip_forward

Disguise connection, install ipmasq:
      # apt-get install ipmasq

And for the last one, run the command:
     # iptables t nat-A POSTROUTING-o eth0-j MASQUERADE (eth0 = eth internet)
(The command above is for internet sharing)

     # iptables-t nat-A PREROUTING-p tcp - dport 80-j REDIRECT - to-port 3128
(This is to divert to port 3128 which is the proxy port)

     # / Etc / init.d / squid start

it's easy right ?? 
Share: