0

Как создать контейнер для proxmox

Делаю контейнер Debian 6 с предустановленным mc и настроенным на utf8 в Московской временной зоне.

 

Step 1) Create a virtual machine using whatever template you like.
Step 2) enter the virtual machine (vzctl enter CTID)
where CTID is the ID of the virtual machine
Step 3) Install/remove any software you want:

  1. Обновляем и настраиваем Utf8 и русскую локаль
    1. apt-get update
    2. apt-get upgrade
    3. apt-get install aptitude
    4. dpkg-reconfigure locales  (выбираем ru_UTF8)
    5. su (перезаходим, что бы изменения вступили в силу)
    6. apt-get install mc (устанавливаем mc)
  2. Устанавливаем временную зону Москвы, что бы показывал московское время
    1. # rm /etc/localtime
    2. # ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

Step 4) Exit out of the virtual machine (but do not stop it)
Step 5) remove the ip address from the virtual machine
vzctl set CTID —ipdel all —save
or use the web interface to remove the ip address
Step 6) Stop the virtual machine
vzctl stop CTID
or use the web interface
Step 7) change directory to the virtual machines directory
cd /var/lib/vz/private/CTID
Step 8) tar the directory
tar –czvf /var/lib/vz/template/cache/debian-6.0-standard.ru.utf8_6.0-4_i386.tar.gz .
Note: the commands ends with a space followed by a period
Make sure you are in the directory for the virtual container
(/var/lib/vz/private/CTID)

 

Подробее можно почитать тут: http://forum.proxmox.com/threads/452-Creating-custom-templates

7

Настройка csync2

Установка

Установка должна быть произведена на всех нодах кластера:

Из репозиториев debian\ubuntu

apt-get install csync2 sqlite rsync –y

сгенерировать сертификат вручную:
openssl genrsa -out /etc/csync2_ssl_key.pem 1024
openssl req -new -key /etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.csr
openssl x509 -req -days 600 -in /etc/csync2_ssl_cert.csr -signkey /etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.pem

После чего нужно запустить генерацию ключа csync2:
csync2 -k /etc/csync2.cluster.key

Continue Reading

2

Настройка iptables на VPS c Debian 6

Не успел установить VPS и настроить WEB сервер, как обнаружил, что огромное количество спамеров пытаются разослать через мой postfix всякую гадость. Плюс постоянно стараются подобрать пароль к SSH. А у меня сервер на Cloud хостинге, где плачу за все телодвижения, в том числе за совсем не нужные нагрузки.

Так порывшись в сети нашел следующие, на мой взгляд достаточные, настойки iptables.

1. Для начала создайте исполняемый файл:

/etc/network/if-up.d/00-firewall

 

Continue Reading

0

Авторизация без пароля OpenSSH

Because OpenSSH allows you to run commands on remote systems, showing you the results directly, as well as just logging in to systems it’s ideal for automating common tasks with shellscripts and cronjobs. One thing that you probably won’t want is to do though is store the remote system’s password in the script. Instead you’ll want to setup SSH so that you can login securely without having to give a password.

Thankfully this is very straightforward, with the use of public keys.

To enable the remote login you create a pair of keys, one of which you simply append to a file upon the remote system. When this is done you’ll then be able to login without being prompted for a password — and this also includes any cronjobs you have setup to run.

If you don’t already have a keypair generated you’ll first of all need to create one.

If you do have a keypair handy already you can keep using that, by default the keys will be stored in one of the following pair of files:

  • ~/.ssh/identity and ~/.ssh/identity.pub
    • (This is an older DSA key).
  • ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub
    • (This is a newer RSA key).

If you have neither of the two files then you should generate one. The DSA-style keys are older ones, and should probably be ignored in favour of the newer RSA keytypes (unless you’re looking at connecting to an outdated installation of OpenSSH). We’ll use the RSA keytype in the following example.

To generate a new keypair you run the following command:

skx@lappy:~$ ssh-keygen -t rsa

This will prompt you for a location to save the keys, and a pass-phrase:

Generating public/private rsa key pair. Enter file in which to save the key (/home/skx/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/skx/.ssh/id_rsa. Your public key has been saved in /home/skx/.ssh/id_rsa.pub.

If you accept the defaults you’ll have a pair of files created, as shown above, with no passphrase. This means that the key files can be used as they are, without being "unlocked" with a password first. If you’re wishing to automate things this is what you want.

Now that you have a pair of keyfiles generated, or pre-existing, you need to append the contents of the .pub file to the correct location on the remote server.

Assuming that you wish to login to the machine called mystery from your current host with the id_rsa and id_rsa.pub files you’ve just generated you should run the following command:

ssh-copy-id -i ~/.ssh/id_rsa.pub username@mystery

This will prompt you for the login password for the host, then copy the keyfile for you, creating the correct directory and fixing the permissions as necessary.

The contents of the keyfile will be appended to the file ~/.ssh/authorized_keys2 for RSA keys, and ~/.ssh/authorised_keys for the older DSA key types.

Once this has been done you should be able to login remotely, and run commands, without being prompted for a password:

skx@lappy:~$ ssh mystery uptime 09:52:50 up 96 days, 13:45, 0 users, load average: 0.00, 0.00, 0.00

2

Zend сервер с нуля на Debian 6

  1. Обновляем и настраиваем Utf8 и русскую локаль
    1. apt-get update
    2. apt-get upgrade
    3. apt-get install aptitude
    4. aptitude install language-env
    5. dpkg-reconfigure locales
    6. aptitude install console-cyrillic
  2. Установка временной зоны, что бы показывал московское время
    1. # rm /etc/localtime
    2. # ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
  3. Установка Zend Server CE
    1. установить gnupg для проверки ключей доступа к репозиторию:
      # apt-get install gnupg
    2. прописать в файл /etc/apt/sources.list стоку:
      # deb http://repos.zend.com/zend-server/deb server non-free
    3. Добавить ключ репозитория:
      # wget http://repos.zend.com/zend.key -O- |apt-key add —
    4. Обновить репозиторий
      # aptitude update
    5. Устанавливаем nginx:
      # apt-get install nginx
    6. Устанавливаем Zend Server CE и apache2:
      # apt-get install zend-base
      libapache2-mod-php-5.3-zend-server
      php-5.3-xmlrpc-zend-server
      php-5.3-optimizer-plus-zend-server
      php-5.3-zem-zend-server
      php-5.3-curl-zend-server
      php-5.3-data-cache-zend-server
      php-5.3-mbstring-zend-server
      php-5.3-mcrypt-zend-server
      php-5.3-memcache-zend-server
      php-5.3-mysql-zend-server
      php-5.3-gd-zend-server
      php-5.3-ctype-zend-server
      php-5.3-json-zend-server
      php-5.3-zip-zend-server
      php-5.3-dev-zend-server – для работы php из командной строки выполнить в файл /etc/environment необходимо дописать следующие переменны:
      PATH=$PATH:/usr/local/zend/bin
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
    7. Создайте симлинк /usr/local/zend/bin/php в /bin/php
    8. Установим rpaf для ретрансляции IP от апача к nginx:
      apt-get install libapache2-mod-rpaf
    9. Теперь донастраиваем nginx и апач под свои нужны и сервер готов!