My Linux FAQ

  • Установка статического IP адреса для сетевого адаптера

По умолчанию при установке задан параметр использовать DHCP для получения IP адреса. Для того, чтобы задать статический IP делаем следующее:


вывод списка сетевых интерфейсов, в нашем случае используется eth0

1. Создайте резервную копию файла /etc/network/interfaces, введя в терминале следующую команду:
cp /etc/network/interfaces /etc/network/interfaces.backup

2. Редактируем содержимое /etc/network/interfaces

# nano /etc/network/interfaces
iface eth0 inet dhcp' на 'iface eth0 inet static

3. Добавьте следующие строки, подставив ваши значения IP адресов и других конфигураций, получится следующее:

iface eth0 inet static

Сохраним изменения в файле

Отключим интерфейс eth0:
ifdown eth0
Затем включим eth0:
ifup eth0
Теперь сетевой адрес настроен.



  • Прописываем репозитории

Репозиторий — это хранилище программ и прочих файлов.

Итак, после установки Debian без указания статического IP или PROXY репозитории не обнаруживаются и как следстви не прописываются. Пропишем их вручную:

1. Ссылки на файл репозиторий можно сгенерировать на странице

2. Добавить в sources.list ссылки на репозитории:
# nano /etc/apt/sources.list

последнюю строку оставить пустой, знак # в начале строки — означает комментарий, такие строки не обрабатываются

###### Debian Main Repos
deb stable main non-free
deb stable-updates main non-free
deb stable/updates main

Для сохранения нажать CTRL+O   ,  затем нажать Enter
Для выхода из программы нажать CTRL+X

3. Обновить список доступных пакетов:
# apt-get update


# aptitude update

Можно приступать к установке программ…

Примечание: некоторые репозитории подключаются только после скачивания специального ключа
(обычно где написан реп написано и как скачать ключ (key) )
в этом случае добавляем реп, скачиваем ключ, обновляем список пакетов, и устанавливаем что хотим…

Способ номер два:
#apt-get update
И ставим то, что Вам необходимо из репозитория

В случае, если у вас репозиторий на CD/DVD, добавить его можно так:
# apt-cdrom add

В качестве репозитория можно указать папку с обновлениями:

2.2 How to use APT locally

Sometimes you have lots of packages .deb that you would like to use APT to install so that the dependencies would be automatically solved.

To do that create a directory and put the .debs you want to index in it . For example:
# mkdir /root/debs

You may modify the definitions set on the package’s control file directly for your repository using an override file. Inside this file you may want to define some options to override the ones that come with the package. It looks like follows:
package priority section

package is the name of the package, priority is low, medium or high and section is the section to which it belongs. The file name does not matter, you’ll have to pass it as an argument for dpkg-scanpackages later. If you do not want to write an override file, just use /dev/null. when calling dpkg-scanpackages.

Still in the /root directory do:
# dpkg-scanpackages debs file | gzip > debs/Packages.gz

In the above line, file is the override file, the command generates a file Packages.gz that contains various information about the packages, which are used by APT. To use the packages, finally, add:
deb file:/root debs/

After that just use the APT commands as usual. You may also generate a sources repository. To do that use the same procedure, but remember that you need to have the files .orig.tar.gz, .dsc and .diff.gz in the directory and you have to use Sources.gz instead of Packages.gz. The program used is also different. It is dpkg-scansources. The command line will look like this:
# dpkg-scansources debs | gzip > debs/Sources.gz

Notice that dpkg-scansources doesn’t need an override file. The sources.list’s line is:
deb-src file:/root debs/




2.3 Deciding which mirror is the best to include in the sources.list file: netselect, netselect-apt

A very frequent doubt, mainly among the newest users is: «which Debian mirror to include in sources.list?». There are many ways to decide which mirror. The experts probably have a script that measures the ping time through the several mirrors. But there’s a program that does this for us: netselect

To install netselect, as usual:
# apt-get install netselect

Executing it without parameters shows the help. Executing it with a space-separated list of hosts (mirrors), it will return a score and one of the hosts. This score takes in consideration the estimated ping time and the hops (hosts by which a network query will pass by to reach the destination) number and is inversely proportional to the estimated download speed (so, the lower, the better). The returned host is the one that had the lowest score (the full list of scores can be seen adding the -vv option). See this example:
# netselect
365< #/code>

This means that, from the mirrors included as parameters to netselect, was the best, with an score of 365. (Attention!! As it was done on my computer and the network topography is extremely different depending on the contact point, this value is not necessarily the right speed in other computers).

Now, just put the fastest mirror found by netselect in the /etc/apt/sources.list file (see The /etc/apt/sources.list file, Section 2.1) and follow the tips in Managing packages, Chapter 3.

Note: the list of mirrors may always be found in the file

Beginning with the 0.3.ds1 version, the netselect source package includes the netselect-apt binary package, which makes the process above automatic. Just enter the distribution tree as parameter (the default is stable) and the sources.list file will be generated with the best main and non-US mirrors and will be saved under the current directory. The following example generates a sources.list of the stable distribution:
# ls sources.list
ls: sources.list: File or directory not found
# netselect-apt stable
# ls -l sources.list

Remember: the sources.list file is generated under the current directory, and must be moved to the /etc/apt directory.

Then, follow the tips in Managing packages, Chapter 3.

Источник: apt-howto


  • Сервер точного времени (настройка RTP)

  • GUI



  • Digg
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS