OpenVZ Forum


Home » International » Russian » как создать свой template?
как создать свой template? [message #782] Tue, 10 January 2006 12:28 Go to next message
hostill is currently offline  hostill
Messages: 18
Registered: January 2006
Junior Member

На сайте я нашел несколько templates для fc-4 и т.д. инетесует вот что, можно ли создать свой темплайт с необходимым софтом? Или на базе вашего template создать свой, ну то есть грубо говоря набить его необходимым софтом?
Re: как создать свой template? [message #838 is a reply to message #782] Mon, 16 January 2006 12:45 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Именно так.

Если этот софт входит в базовую поставку дистрибутива, его RPMы нужно просто перечислить в файле /vz/template/OSNAME/OSVERSION/OSARCH/config/NAME.list

Если вы берёте его откуда-то "слева", то можно создать VPS, поставить туда софт и потом запаковать /vz/root/NNN снова в тарболл, который и использовать в качестве template cache. Перед запаковкой необходимо вычистить из VPSa всякую специфику - айпи адреса, пароли в /etc/passwd и т.п.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: как создать свой template? [message #867 is a reply to message #838] Tue, 17 January 2006 11:49 Go to previous messageGo to next message
hostill is currently offline  hostill
Messages: 18
Registered: January 2006
Junior Member

Вообсчем еще вылезло вот что,
я сделал свой тарбол на основе вашего темплайта + свой софт положил его в cache/fedora-core4-full.tar.gz
теперь создаю сервер
$vzctl create 252 --ostemplate fedora-core4-full
Creating VPS private area: /vz/private/252
Unable to get full ostemplate name for fedora-core4-full
Warning: configuration file for distribution fedora-core4-full not found default used
Performing postcreate actions
VPS private area was created


странно вот это:
Unable to get full ostemplate name for fedora-core4-full
Warning: configuration file for distribution fedora-core4-full not found default used


Но ладно, далее задаем параметры впсу и опять вылезает
$vzctl set 252 --hostname dorw.ru --save
Warning: configuration file for distribution fedora-core4-full not found default used
Saved parameters for VPS 252


ну и конечно же он отказывается стартовать
vzctl start 252
Warning: configuration file for distribution fedora-core4-full not found default used
Starting VPS ...
VPS is mounted
Adding IP address(es): хххюхххюхх
Setting CPU units: 1000
Set hostname: dorw.ru
Unable to start init, probably incorrect template
VPS start failed
Stopping VPS ...
VPS was stopped
VPS is unmounted


далее создаем кофниг для него такой fedora-core4-full.conf на основе этого fedora-core-4.conf

но все равно пристарте такая вот борода
vzctl start 252
Starting VPS ...
VPS is mounted
Adding IP address(es): ххчххчххч
Setting CPU units: 1000
Set hostname: dorw.ru
Unable to start init, probably incorrect template
VPS start failed
Stopping VPS ...
VPS was stopped
VPS is unmounted


плз подскажите где еще нужно подправить?

[Updated on: Tue, 17 January 2006 12:05]

Report message to a moderator

Re: как создать свой template? [message #868 is a reply to message #867] Tue, 17 January 2006 12:14 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Quote:

странно вот это:
Unable to get full ostemplate name for fedora-core4-full
Warning: configuration file for distribution fedora-core4-full not found default used



Поставьте чёрточку между core и 4 в имя tar.gz файла (ну и в аргумент команды --ostemplate)

Quote:

Unable to start init, probably incorrect template
VPS start failed
Stopping VPS ...
VPS was stopped
VPS is unmounted



Это совсем другая проблема -- вероятно, вы неправильно запаковали тарболл, там, похоже, нет файла /sbin/init внутри. Очевидно, что это можно легко проверить, например, так:

tar tvzf /vz/template/cache/fedora-core4-full.tar.gz | grep sbin/init


Должно получиться как минимум что-то вот такое:
-rwxr-xr-x 0/0           31216 2005-04-27 19:42:41 ./sbin/init



Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: как создать свой template? [message #2432 is a reply to message #868] Tue, 04 April 2006 17:09 Go to previous messageGo to next message
KreG7 is currently offline  KreG7
Messages: 7
Registered: March 2006
Junior Member
добрый день. у меня возникла такая же проблема:
создал VPS со всем что было необходимо, создал fc4-v1.tar.gz и решил попробовать создать из template новую VPS

[root@test ~]# vzctl create 102 --ostemplate fc4-v1 --config vps.basic
Creating VPS private area: /vz/private/102
Unable to get full ostemplate name for fc4-v1
Warning: configuration file for distribution fc4-v1 not found default used
Performing postcreate actions
VPS private area was created
[root@test ~]#

и возникла такая трабла - по ssh связываться не дает, говорит мол есть уже такой код, обратитесь к админу... как сделать в template универсальность к ssh и ssl сертификат в apache создавать автоматически? я пока так и не могу разобраться, при ручном принудительном генерации rsa и dsa, все равно остается старый (из первой VPS) ssh ключи... Sad


P.S. хотя кое что нашел Smile
http://forum.openvz.org/index.php?t=tree&goto=359&&a mp;a mp;srch=template+ssh#msg_359

завтра попробую...

[Updated on: Tue, 04 April 2006 17:24]

Report message to a moderator

Re: как создать свой template? [message #2437 is a reply to message #2432] Tue, 04 April 2006 21:03 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Перед тем, как запаковывать VPS, надо просто удалить ключи (что-то типа rm etc/ssh/*key). При первом старте VPSa они сгенерятся.

PS имя темплейта лучше делать так, чтобы vzctl понял, какой это дистрибутив. То есть федору лучше называть fedora-core-4-i386-чтототам.tar.gz


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: как создать свой template? [message #2438 is a reply to message #2437] Wed, 05 April 2006 05:16 Go to previous messageGo to next message
KreG7 is currently offline  KreG7
Messages: 7
Registered: March 2006
Junior Member
попробую... а как быть с ssl ?
Re: как создать свой template? [message #2439 is a reply to message #2438] Wed, 05 April 2006 05:18 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Так же -- удалить перед паковкой темплейта.

Если эти сертификаты не создаются при первом старте - написать маленький скрипт, который их создаёт и сам себя удаляет.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: как создать свой template? [message #2440 is a reply to message #2439] Wed, 05 April 2006 07:00 Go to previous message
KreG7 is currently offline  KreG7
Messages: 7
Registered: March 2006
Junior Member
т.е. , насколько я понял , ssh и ssl генерится автоматически, если их в temlate удалить, или надо :

rm -f /etc/ssh/ssh_host_*
cat << EOF > /etc/rc2.d/S15ssh_gen_host_keys
#!/bin/bash
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
rm -f \$0
EOF
chmod a+x /etc/rc2.d/S15ssh_gen_host_keys

так ?

вот только для ssl надо вроде еще кучу вопросов отвечать Sad + настроить обработку окруженя


цитата:
Все команды, перечисленные ниже, выполняются в каталоге /etc/ssl.

1.1. Создание приватного ключа RSA, защищенного парольной фразой, для Вашего сервера Apache.

[root@deep ssl]# openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
......................+++++.....+++++
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

Пожалуйста, создайте резервную копию файла server.key и запомните парольную фразу.

1.2. Создание Certificate Signing Request (CSR) с серверным приватным ключом RSA.

[root@deep ssl]# openssl req -new -key server.key -out server.csr
Using configuration from /etc/ssl/openssl.cnf
Enter PEM pass phrase:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [CA]:
State or Province Name (full name) [Quebec]:
Locality Name (eg, city) [Montreal]:
Organization Name (eg, company) [Open Network Architecture]:
Organizational Unit Name (eg, section) [Internet Department]:
Common Name (eg, YOUR name) [www.openna.com]:
Email Address [admin@openna.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:.
An optional company name []:.

ЗАМЕЧАНИЕ. Убедитесь, что Вы ввели FQDN (полностью определенное доменное имя (Fully Qualified Domain Name)) сервера, когда OpenSSL спросил Вас о CommonName (например, когда Вы создаете CSR для веб-сервера, который будет позже доступен через https://www.mydomain.com, введите www.mydomain.com).


Вы с таким не сталкивались ?
Previous Topic: OpenVPN
Next Topic: CentOS 4.3 x86_64 and LVM trouble
Goto Forum:
  


Current Time: Mon Aug 12 04:59:28 GMT 2024

Total time taken to generate the page: 0.02886 seconds