Mang kapa mang ea neng a hloka ho fetisetsa setshelo sa OpenVZ ho seva se nang le virtualization e felletseng ea KVM bonyane hanngoe bophelong ba bona o bile le mathata a mang:
- Boitsebiso bo bongata bo siiloe ke nako 'me bo ne bo sebetsa ho li-OS tse neng li fetile nako e telele ho potoloha EOL
- Lintlha tse fapaneng li lula li fanoa bakeng sa litsamaiso tse fapaneng tsa ts'ebetso, 'me liphoso tse ka bang teng nakong ea ho falla ha ho mohla li nkuoang
- Ka linako tse ling u tlameha ho sebetsana le litlhophiso tseo nako le nako li sa batleng ho sebetsa ka mor'a ho falla
Ha o fetisetsa seva e 1, o ka khona ho lokisa ntho e itseng ka fofa, empa ha o fetisetsa sehlopha sohle?
Sengoliloeng sena ke tla leka ho u joetsa hore na u ka fallisetsa setshelo sa OpenVZ ka nepo joang ho KVM ka nako e fokolang le tharollo e potlakileng ea mathata ohle.
Lenaneo le lenyenyane la thuto: OpenVZ ke eng mme KVM ke eng?
Re ke ke ra kena botebong ba mantsoe, empa re tla bua ka kakaretso:
OpenVZ - virtualization boemong ba tsamaiso ea ts'ebetso, u ka khona ho e sebelisa ka microwave, kaha ha ho hlokahale litaelo tsa CPU le theknoloji ea virtualization mochine o amohelang.
KVM - Virtualization e felletseng, e sebelisa matla ohle a CPU mme e khona ho etsa eng kapa eng, ka tsela efe kapa efe, e e reha ka bolelele le ka tsela e fapaneng.
Ho fapana le tumelo e tloaelehileng ea hore har'a bafani ba baeti ba OpenVZ ba tla rekisoa haholo, empa KVM e ke ke ea - ka lehlohonolo bakeng sa morao-rao, KVM ha e sa rekisoa ho feta mor'abo eona.
Re tla tsoela pele ka eng?
Joaloka lithuto tsa tlhahlobo bakeng sa phetisetso, re ile ra tlameha ho sebelisa moru oohle oa lits'ebetso tse fumanehang ho OpenVZ: CentOS (liphetolelo tsa 6 le 7), Ubuntu (14, 16 le 18 LTS), Debian 7.
Ho ne ho nahanoa hore boholo ba lijana tsa OpenVZ li ne li se li ntse li sebelisa mofuta o itseng oa LAMP, 'me tse ling li bile li e-na le software e khethehileng haholo. Hangata, tsena e ne e le litlhophiso le ISPmanager, VestaCP control panel (mme hangata, e sa ntlafatsoe ka lilemo). Likopo tsa bona tsa phetisetso le tsona li tlameha ho eloa hloko.
Ho falla ho etsoa ha ho ntse ho bolokoa aterese ea IP ea setshelo se fetisitsoeng; re tla nka hore IP eo setshelo se nang le eona e bolokiloe ho VM mme e tla sebetsa ntle le mathata.
Pele o fetisetsa, a re netefatseng hore re na le tsohle matsohong:
- Seva ea OpenVZ, phihlello e felletseng ea motso mochining o amohelang, bokhoni ba ho emisa / ho phahamisa / ho qala / ho hlakola lijana
- Seva ea KVM, phihlello e felletseng ea motso mochining o amohelang, ka sohle seo e se bolelang. Ho nahanoa hore ntho e 'ngoe le e' ngoe e se e hlophisitsoe 'me e loketse ho tsamaea.
Ha re qale ho fetisa
Pele re qala phetisetso, a re hlalose mantsoe a tla u thusa ho qoba pherekano:
KVM_NODE - Mochini oa moamoheli oa KVM
VZ_NODE - Mochini oa moamoheli oa OpenVZ
CTID - Setshelo sa OpenVZ
VM - Seva ea sebele ea KVM
Ho itokiselletsa ho falla le ho theha mechine ea sebele.
hata 1
Kaha re hloka ho tsamaisa setshelo kae-kae, re tla bopa VM ka tlhophiso e ts'oanang ea ho KVM_NODE.
Bohlokoa! U hloka ho theha VM ho sistimi e sebetsang e sebetsang hona joale ho CTID. Ka mohlala, haeba Ubuntu 14 e kentsoe ho CTID, joale Ubuntu 14 e tlameha ho kenngoa ho VM. Liphetolelo tse nyenyane ha li bohlokoa 'me ho se lumellane ha tsona ha ho bohlokoa hakaalo, empa liphetolelo tse kholo li lokela ho tšoana.
Kamora ho theha VM, re tla ntlafatsa liphutheloana ho CTID le VM (eseng ho ferekanngoa le ho ntlafatsa OS - ha re e ntlafatse, re ntlafatsa liphutheloana feela, 'me haeba e fihla, phetolelo ea OS ka har'a sehlooho se seholo. phetolelo).
Bakeng sa CentOS ts'ebetso ena e shebahala e se kotsi:
# yum clean all
# yum update -y
'Me ha ho na kotsi ho Ubuntu le Debian:
# apt-get update
# apt-get upgrade
hata 2
Kenya ho CTID, VZ_NODE и VM thuso rsync:
CentOS:
# yum install rsync -y
Debian, Botho:
# apt-get install rsync -y
Ha re kenye letho le leng moo kapa mane.
hata 3
Re emisa CTID mabapi le VZ_NODE sehlopha
vzctl stop CTID
Ho kenya setšoantšo CTID:
vzctl mount CTID
Eya ho /vz/root/ foldarengCTID le ho phethahatsa
mount --bind /dev dev && mount --bind /sys sys && mount --bind /proc proc && chroot .
Tlas'a motso, theha faele /root/exclude.txt - e tla ba le lethathamo la mekhelo e ke keng ea fihla ho seva se secha.
/boot
/proc
/sys
/tmp
/dev
/var/lock
/etc/fstab
/etc/mtab
/etc/resolv.conf
/etc/conf.d/net
/etc/network/interfaces
/etc/networks
/etc/sysconfig/network*
/etc/sysconfig/hwconf
/etc/sysconfig/ip6tables-config
/etc/sysconfig/kernel
/etc/hostname
/etc/HOSTNAME
/etc/hosts
/etc/modprobe*
/etc/modules
/net
/lib/modules
/etc/rc.conf
/usr/share/nova-agent*
/usr/sbin/nova-agent*
/etc/init.d/nova-agent*
/etc/ips
/etc/ipaddrpool
/etc/ips.dnsmaster
/etc/resolv.conf
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-ens3
Re hokela ho KVM_NODE le ho qala rona VMe le hore e sebetse mme e fumanehe ka marang-rang.
Hona joale tsohle li se li loketse ho fetisoa. Tsamaea!
hata 4
Re ntse re le tlas'a boloi, re sebetsa
rsync --exclude-from="/root/exclude.txt" --numeric-ids -avpogtStlHz --progress -e "ssh -T -o Compression=no -x" / root@KVM_NODE:/
Taelo ea rsync e tla etsa phetiso, re tšepa hore linotlolo li hlakile - phetisetso e etsoa ka ho boloka li-symlink, litokelo tsa phihlello, beng le lihlopha, 'me encryption e koetsoe ka lebelo le leholo (o ka sebelisa cipher e potlakileng, empa sena ha se bohlokoa haholo bakeng sa mosebetsi ona) , hammoho le compression e holofalitsoe.
Kamora ho qeta rsync, tsoa ho chroot (ka ho tobetsa ctrl+d) 'me u phethe.
umount dev && umount proc && umount sys && cd .. && vzctl umount CTID
hata 5
Ha re etseng mehato e 'maloa e tla re thusa ho qala VM ka mor'a ho tsoa ho OpenVZ.
Ho li-server tse nang le Systemd a re phetheng taelo e tla re thusa ho kena ho console e tloaelehileng, mohlala, ka skrine ea seva sa VNC.
mv /etc/systemd/system/getty.target.wants/[email protected] /etc/systemd/system/getty.target.wants/[email protected]
Ho li-server CentOS 6 и CentOS 7 Etsa bonnete ba hore u kenya kernel e ncha:
yum install kernel-$(uname -r)
Seva e ka kenngoa ho eona, empa ka mor'a phetiso e ka emisa ho sebetsa kapa ea hlakoloa.
Ho seva CentOS 7 o hloka ho kenya kopo e nyane bakeng sa PolkitD, ho seng joalo seva se tla senyeha ka ho sa feleng:
getent group polkitd >/dev/null && echo -e "e[1;32mpolkitd group already existse[0m" || { groupadd -r polkitd && echo -e "e[1;33mAdded missing polkitd groupe[0m" || echo -e "e[1;31mAdding polkitd group FAILEDe[0m"; }
getent passwd polkitd >/dev/null
&& echo -e "e[1;32mpolkitd user already existse[0m" || { useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd && echo -e "e[1;33mAdded missing polkitd usere[0m" || echo -e "e[1;31mAdding polkitd user FAILEDe[0m"; }
rpm -Va polkit* && echo -e "e[1;32mpolkit* rpm verification passede[0m" || { echo -e "e[1;33mResetting polkit* rpm user/group ownership & permse[0m"; rpm --setugids polkit polkit-pkla-compat; rpm --setperms polkit polkit-pkla-compat; }
Ho li-server tsohle, haeba mod_fcgid ea Apache e kentsoe, re tla etsa tokiso e nyane ka litokelo, ho seng joalo libaka tse sebelisang mod_fcgid li tla senyeha ka phoso 500:
chmod +s `which suexec` && apachectl restart
'Me ntho ea ho qetela e na le thuso bakeng sa kabo ea Ubuntu le Debian. OS ena e kanna ea oela booting e sa feleng ka phoso
ho lla kapele haholo. phethahatso e kokobetsang hanyane
e sa thabiseng, empa e tsitsitse habonolo, ho latela mofuta oa OS.
mabapi le Debian 9 tokiso e shebahala tjena:
rea etsa
dbus-uuidgen
haeba re fumana phoso
/usr/local/lib/libdbus-1.so.3: phetolelo `LIBDBUS_PRIVATE_1.10.8′ ha e fumanehe
hlahloba boteng ba LIBDBUS
ls -la /lib/x86_64-linux-gnu | grep dbus
libdbus-1.so.3 -> libdbus-1.so.3.14.15
libdbus-1.so.3.14.15 <-- нужен этот
libdbus-1.so.3.14.16
haeba tsohle li lokile, rea li etsa
cd /lib/x86_64-linux-gnu
rm -rf libdbus-1.so.3
ln -s libdbus-1.so.3.14.15 libdbus-1.so.3
Haeba e sa thuse, leka khetho ea bobeli.
Tharollo ea bobeli ea bothata ka phethahatso e kokobetsang hanyane E loketse hoo e batlang e le likhatiso tsohle tsa Ubuntu le Debian.
Rea phetha
bash -x /var/lib/dpkg/info/dbus.postinst configure
Le bakeng sa Ubuntu 14, Debian 7 Ho feta moo, re etsa:
adduser --system --home /nonexistent --no-create-home --disabled-password --group messagebus
rm -rf /etc/init.d/modules_dep.sh
Re entseng? Re khutlisitse molaetsa oa bus, o neng o le sieo ho tsamaisa Debian / Ubuntu, mme ra tlosa modules_dep, e tsoang ho OpenVZ mme e sitisitse ho kenya li-module tse ngata tsa kernel.
hata 6
Re qala VM hape, hlahloba VNC hore na ho jara ho ntse ho tsoela pele joang, 'me, hantle, ntho e' ngoe le e 'ngoe e tla laola ntle le mathata. Le hoja ho ka etsahala hore mathata a mang a itseng a tla hlaha ka mor'a ho falla, a ka holimo ho sebaka sa sehlooho sena 'me a tla lokisoa ha a hlaha.
Ke tšepa hore boitsebiso bona bo molemo! 🙂
Source: www.habr.com