Forwarded from Academy and Foundation unixmens | Your skills, Your future
LXC
مخفف Linux Containers می باشد که یک تکنولوژی مجازی ساز در لایه سیستم عامل می باشد.LXC بسیار سبک و سریع می باشد و امکان میزبانی چندین سیستم لینوکسی ایزوله که در واقع به آن کانتینر می گویند (Containers) را درون یک Host فراهم می آورد.
بر خلاف دیگر مجازی سازها مانند VirtualBox, KVM و vmware سیستم مهمان (guest) از همان کرنل میزبان (host) استفاده می کند.در این مطلب روش نصب،پیکربندی و کار با LXC آموزش داده خواهد شد.
نصب بسته ها :
#apt-get update
#apt-get install lxc lxctl lxc-templates
جهت بررسی وضعیت ,این دستور را اجرا کنید:
# lxc-checkconfig
در پایین خروجی دستور گفته شده را مشاهده می کنید :
# lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching…
Kernel configuration found at /boot/config-3.13.0-29-generic
— Namespaces —
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled
— Control groups —
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
— Misc —
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
ساخت Linux Containers :
تمامی فایل های نمونه کانینر ها در این مسیر قرار دارند :
/usr/share/lxc/templates/
جهت دیدن انها کافیست تا این دستور را اجرا کنید :
#ls /usr/share/lxc/templates/
خروجی دستور بالا را در پایین مشاهده می کنید :
#ls /usr/share/lxc/templates/
lxc-alpine lxc-archlinux lxc-centos lxc-debian lxc-fedora lxc-openmandriva
lxc-oracle lxc-sshd lxc-ubuntu-cloud lxc-altlinux lxc-busybox lxc-cirros lxc-download
lxc-gentoo lxc-opensuse lxc-plamo lxc-ubuntu
دستور کلی برای ساخت کانینر به این صورت می باشد :
#lxc-create -n <container-name> -t <template>
به عنوان نمونه :
#lxc-create -n ubuntu01 -t ubuntu
در دستور بالا کانتینری با نام ubuntu01 ایجاد خواهد شد که در پایین خروجی دستور را مشاهده می کنید :
# lxc-create -n ubuntu01 -t ubuntu
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 …
Installing packages in template: ssh,vim,language-pack-en
Downloading ubuntu trusty minimal …
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id ۷۹۰BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages
I: Validating Packages
I: Retrieving Packages
I: Validating Packages
…
.
.
.
Generation complete.
Processing triggers for libc-bin (۲٫۱۹-۰ubuntu6.6) …
Processing triggers for initramfs-tools (۰٫۱۰۳ubuntu4.2) …
Download complete
Copy /var/cache/lxc/trusty/rootfs-amd64 to /var/lib/lxc/ubuntu01/rootfs …
Copying rootfs to /var/lib/lxc/ubuntu01/rootfs …
Generating locales…
en_US.UTF-8… up-to-date
Generation complete.
Creating SSH2 RSA key; this may take some time …
Creating SSH2 DSA key; this may take some time …
Creating SSH2 ECDSA key; this may take some time …
Creating SSH2 ED25519 key; this may take some time …
update-rc.d: warning: default stop runlevel arguments (۰ ۱ ۶) do not match ssh Default-Stop values (none)
invoke-rc.d: policy-rc.d denied execution of start.
Current default time zone: ‘Etc/UTC’
Local time is now: Sat Jun ۱۳ ۱۴:۲۹:۲۵ UTC ۲۰۱۵٫
Universal Time is now: Sat Jun ۱۳ ۱۴:۲۹:۲۵ UTC ۲۰۱۵٫
##
# The default user is ‘ubuntu‘ with password ‘ubuntu‘!
# Use the ‘sudo’ command to run tasks as root in the container.
##
همانطور که در انتهای خروجی بالا مشاهده می کند نام کاربری و پسورد ورود به کانتینر ساخته شده ubuntu می باشد.
Starting Containers
بعد ساختن کانتینر برای start کردن ان کافیست تا دستور پایین را اجرا کنید :
#lxc-start -n ubuntu01 -d
جهت لاگین کردن به کانتینر از این دستور باید استففاده کرد :
#lxc-console -n ubuntu01
بعد از اجرای دستور بالا نام کاربری و پسورد ورود را درخواست می کند که اگر دقت کرده باشید این مشخصات را در پایان پیغام،هنگام ساختن کانتینر نمایش داده شد.در پایین خروجی دستور بالا مشاهده می کنید :
Ubuntu ۱۴٫۰۴٫۲ LTS ubuntu01 tty1
ubuntu01 login: ubuntu
Password:
مخفف Linux Containers می باشد که یک تکنولوژی مجازی ساز در لایه سیستم عامل می باشد.LXC بسیار سبک و سریع می باشد و امکان میزبانی چندین سیستم لینوکسی ایزوله که در واقع به آن کانتینر می گویند (Containers) را درون یک Host فراهم می آورد.
بر خلاف دیگر مجازی سازها مانند VirtualBox, KVM و vmware سیستم مهمان (guest) از همان کرنل میزبان (host) استفاده می کند.در این مطلب روش نصب،پیکربندی و کار با LXC آموزش داده خواهد شد.
نصب بسته ها :
#apt-get update
#apt-get install lxc lxctl lxc-templates
جهت بررسی وضعیت ,این دستور را اجرا کنید:
# lxc-checkconfig
در پایین خروجی دستور گفته شده را مشاهده می کنید :
# lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching…
Kernel configuration found at /boot/config-3.13.0-29-generic
— Namespaces —
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled
— Control groups —
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
— Misc —
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
ساخت Linux Containers :
تمامی فایل های نمونه کانینر ها در این مسیر قرار دارند :
/usr/share/lxc/templates/
جهت دیدن انها کافیست تا این دستور را اجرا کنید :
#ls /usr/share/lxc/templates/
خروجی دستور بالا را در پایین مشاهده می کنید :
#ls /usr/share/lxc/templates/
lxc-alpine lxc-archlinux lxc-centos lxc-debian lxc-fedora lxc-openmandriva
lxc-oracle lxc-sshd lxc-ubuntu-cloud lxc-altlinux lxc-busybox lxc-cirros lxc-download
lxc-gentoo lxc-opensuse lxc-plamo lxc-ubuntu
دستور کلی برای ساخت کانینر به این صورت می باشد :
#lxc-create -n <container-name> -t <template>
به عنوان نمونه :
#lxc-create -n ubuntu01 -t ubuntu
در دستور بالا کانتینری با نام ubuntu01 ایجاد خواهد شد که در پایین خروجی دستور را مشاهده می کنید :
# lxc-create -n ubuntu01 -t ubuntu
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 …
Installing packages in template: ssh,vim,language-pack-en
Downloading ubuntu trusty minimal …
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id ۷۹۰BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages
I: Validating Packages
I: Retrieving Packages
I: Validating Packages
…
.
.
.
Generation complete.
Processing triggers for libc-bin (۲٫۱۹-۰ubuntu6.6) …
Processing triggers for initramfs-tools (۰٫۱۰۳ubuntu4.2) …
Download complete
Copy /var/cache/lxc/trusty/rootfs-amd64 to /var/lib/lxc/ubuntu01/rootfs …
Copying rootfs to /var/lib/lxc/ubuntu01/rootfs …
Generating locales…
en_US.UTF-8… up-to-date
Generation complete.
Creating SSH2 RSA key; this may take some time …
Creating SSH2 DSA key; this may take some time …
Creating SSH2 ECDSA key; this may take some time …
Creating SSH2 ED25519 key; this may take some time …
update-rc.d: warning: default stop runlevel arguments (۰ ۱ ۶) do not match ssh Default-Stop values (none)
invoke-rc.d: policy-rc.d denied execution of start.
Current default time zone: ‘Etc/UTC’
Local time is now: Sat Jun ۱۳ ۱۴:۲۹:۲۵ UTC ۲۰۱۵٫
Universal Time is now: Sat Jun ۱۳ ۱۴:۲۹:۲۵ UTC ۲۰۱۵٫
##
# The default user is ‘ubuntu‘ with password ‘ubuntu‘!
# Use the ‘sudo’ command to run tasks as root in the container.
##
همانطور که در انتهای خروجی بالا مشاهده می کند نام کاربری و پسورد ورود به کانتینر ساخته شده ubuntu می باشد.
Starting Containers
بعد ساختن کانتینر برای start کردن ان کافیست تا دستور پایین را اجرا کنید :
#lxc-start -n ubuntu01 -d
جهت لاگین کردن به کانتینر از این دستور باید استففاده کرد :
#lxc-console -n ubuntu01
بعد از اجرای دستور بالا نام کاربری و پسورد ورود را درخواست می کند که اگر دقت کرده باشید این مشخصات را در پایان پیغام،هنگام ساختن کانتینر نمایش داده شد.در پایین خروجی دستور بالا مشاهده می کنید :
Ubuntu ۱۴٫۰۴٫۲ LTS ubuntu01 tty1
ubuntu01 login: ubuntu
Password:
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Welcome to Ubuntu ۱۴٫۰۴٫۲ LTS (GNU/Linux ۳٫۱۳٫۰-۲۹-generic x86_64)
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
ubuntu@ubuntu01:~$
جهت ساخت کانینر های که بر پایه ی rpm هستند مانند centos ابتدا این دستور را اجرا کنید :
#apt-get install yum
اکنون جهت ساخت یک کانینر centos این دستور را اجرا کنید :
#lxc-create -n centos01 -t centos
بعد از اجرای دستور بالا یکسری بسته نصب خواهد شد و در پایان پیغام ها اینچنین متنی را مشاهده خواهید کرد که در واقع مسیر ذخیره سازی و روش بازیابی پسورد کاربر root مربوط به کانتینر centos را نمایش داده است :
.
.
.
Complete!
Fixing rpmdb location …
Download complete.
Copy /var/cache/lxc/centos/x86_64/6/rootfs to /var/lib/lxc/centos01/rootfs …
Copying rootfs to /var/lib/lxc/centos01/rootfs …
sed: can’t read /etc/init/tty.conf: No such file or directory
Storing root password in ‘/var/lib/lxc/centos01/tmp_root_pass’
Expiring password for user root.
passwd: Success
Container rootfs and config have been created.
Edit the config file to check/enable networking setup.
The temporary root password is stored in:
‘/var/lib/lxc/centos01/tmp_root_pass’
The root password is set up as expired and will require it to be changed
at first login, which you should do as soon as possible. If you lose the
root password or wish to change it without starting the container, you
can change it from the host by running the following command (which will
also reset the expired flag):
chroot /var/lib/lxc/centos01/rootfs passwd
پس از ورود به کانتینر centos درخواستی مبنی بر تعویض رمز عبور را مشاهده خواهید کرد.
جهت ساخت کانتینر opensuse از این دستور استفاده کنید :
#lxc-create -n opensuse1 -t opensuse
جهت خروج از کانینر کافیست تا Ctrl+a و سپس q را فشار دهید تا به ماشین host برگردید.توجه داشته باشید کانتینر در حالت اجرا باقی می ماند و فقط از کنسول آن خارج خواهید شد.جهت بازگشت دوباره به کنسول کانتینر می توانید این دستور را اجرا کنید :
#lxc-console -n ubuntu01
نمایش لیست کانتینر ها :
جهت نمایش لیستی از کانینر ها که روی ماشین host هستند از این دستور می توان استفاده کرد :
#lxc-ls
یک نمونه خروجی دستور بالا را در پایین مشاهده می کنید :
#lxc-ls
centos01
نمایش جزئیات کامل یک کانتینر :
جهت نماش اطلاعات بیشتر از یک کانتینر کافیست تا این دستور را اجرا کنید :
#lxc-info -n centos01
به جای centos01 باید نام کانتینر مورد نظر خود را بنویسید.در پایین خروجی دستور بالا را مشاهده می کنید :
# lxc-info -n centos01
Name: centos01
State: RUNNING
PID: ۱۷۱۷
IP: ۱۰٫۰٫۳٫۱۴۹
CPU use: ۰٫۸۰ seconds
BlkIO use: ۸٫۹۳ MiB
Memory use: ۱۲٫۰۵ MiB
KMem use: ۰ bytes
Link: vethS9FTPV
TX bytes: ۱٫۸۸ KiB
RX bytes: ۱٫۸۴ KiB
Total bytes: ۳٫۷۲ KiB
همانطور که مشاهده می کنید State, CPU usage و Memory usage کانتینر نمایش داده می شود.
نمایش IP address و وضعیت یک کانتینر :
جهت مشاهده ی وضعیت و IP Address یک کانتینر کافیست تا این دستور را اجرا کنید :
#lxc-ls —fancy centos01
به جای centos01 باید نام کانتینر مورد نظر را بنویسید.در پایین خروجی مربوط به دستور بالا را مشاهده می کنید :
#lxc-ls —fancy centos01
NAME STATE IPV4 IPV6 AUTOSTART
———————————————-
centos01 RUNNING ۱۰٫۰٫۳٫۱۴۹ – NO
Stopping Containers
جهت stop کردن یک کانتینر کافیست تا از این دستور استفاده کنید :
#lxc-stop -n centos01
توجه داشته باشید بجای centos01 باید نام کانینر مورد نظر خود را بنویسید.
اکنون جهت بررسی وضعیت کانتینر می توانید این دستور را احرا کنید :
#lxc-ls —fancy centos01
که همچین خروجی ای را مشاهده خواهید کرد :
#lxc-ls —fancy centos01
NAME STATE IPV4 IPV6 AUTOSTART
—————————————-
centos01 STOPPED – – NO
Cloning Containers
این قابلیت وجود دارد که از یک کانتینر clone تهیه کردوبرای اینکار برای مثال قصد داریم تا از کانتینر centos01 یک clone با نام centos02 تهیه کنیم.به همین خاطر کافیست تا این دستور را اجرا کرد :
#lxc-clone centos01 centos02
با احرای دستور بالا چیزی شبیه به این را در خروجی مشاهده خواهید کرد :
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
ubuntu@ubuntu01:~$
جهت ساخت کانینر های که بر پایه ی rpm هستند مانند centos ابتدا این دستور را اجرا کنید :
#apt-get install yum
اکنون جهت ساخت یک کانینر centos این دستور را اجرا کنید :
#lxc-create -n centos01 -t centos
بعد از اجرای دستور بالا یکسری بسته نصب خواهد شد و در پایان پیغام ها اینچنین متنی را مشاهده خواهید کرد که در واقع مسیر ذخیره سازی و روش بازیابی پسورد کاربر root مربوط به کانتینر centos را نمایش داده است :
.
.
.
Complete!
Fixing rpmdb location …
Download complete.
Copy /var/cache/lxc/centos/x86_64/6/rootfs to /var/lib/lxc/centos01/rootfs …
Copying rootfs to /var/lib/lxc/centos01/rootfs …
sed: can’t read /etc/init/tty.conf: No such file or directory
Storing root password in ‘/var/lib/lxc/centos01/tmp_root_pass’
Expiring password for user root.
passwd: Success
Container rootfs and config have been created.
Edit the config file to check/enable networking setup.
The temporary root password is stored in:
‘/var/lib/lxc/centos01/tmp_root_pass’
The root password is set up as expired and will require it to be changed
at first login, which you should do as soon as possible. If you lose the
root password or wish to change it without starting the container, you
can change it from the host by running the following command (which will
also reset the expired flag):
chroot /var/lib/lxc/centos01/rootfs passwd
پس از ورود به کانتینر centos درخواستی مبنی بر تعویض رمز عبور را مشاهده خواهید کرد.
جهت ساخت کانتینر opensuse از این دستور استفاده کنید :
#lxc-create -n opensuse1 -t opensuse
جهت خروج از کانینر کافیست تا Ctrl+a و سپس q را فشار دهید تا به ماشین host برگردید.توجه داشته باشید کانتینر در حالت اجرا باقی می ماند و فقط از کنسول آن خارج خواهید شد.جهت بازگشت دوباره به کنسول کانتینر می توانید این دستور را اجرا کنید :
#lxc-console -n ubuntu01
نمایش لیست کانتینر ها :
جهت نمایش لیستی از کانینر ها که روی ماشین host هستند از این دستور می توان استفاده کرد :
#lxc-ls
یک نمونه خروجی دستور بالا را در پایین مشاهده می کنید :
#lxc-ls
centos01
نمایش جزئیات کامل یک کانتینر :
جهت نماش اطلاعات بیشتر از یک کانتینر کافیست تا این دستور را اجرا کنید :
#lxc-info -n centos01
به جای centos01 باید نام کانتینر مورد نظر خود را بنویسید.در پایین خروجی دستور بالا را مشاهده می کنید :
# lxc-info -n centos01
Name: centos01
State: RUNNING
PID: ۱۷۱۷
IP: ۱۰٫۰٫۳٫۱۴۹
CPU use: ۰٫۸۰ seconds
BlkIO use: ۸٫۹۳ MiB
Memory use: ۱۲٫۰۵ MiB
KMem use: ۰ bytes
Link: vethS9FTPV
TX bytes: ۱٫۸۸ KiB
RX bytes: ۱٫۸۴ KiB
Total bytes: ۳٫۷۲ KiB
همانطور که مشاهده می کنید State, CPU usage و Memory usage کانتینر نمایش داده می شود.
نمایش IP address و وضعیت یک کانتینر :
جهت مشاهده ی وضعیت و IP Address یک کانتینر کافیست تا این دستور را اجرا کنید :
#lxc-ls —fancy centos01
به جای centos01 باید نام کانتینر مورد نظر را بنویسید.در پایین خروجی مربوط به دستور بالا را مشاهده می کنید :
#lxc-ls —fancy centos01
NAME STATE IPV4 IPV6 AUTOSTART
———————————————-
centos01 RUNNING ۱۰٫۰٫۳٫۱۴۹ – NO
Stopping Containers
جهت stop کردن یک کانتینر کافیست تا از این دستور استفاده کنید :
#lxc-stop -n centos01
توجه داشته باشید بجای centos01 باید نام کانینر مورد نظر خود را بنویسید.
اکنون جهت بررسی وضعیت کانتینر می توانید این دستور را احرا کنید :
#lxc-ls —fancy centos01
که همچین خروجی ای را مشاهده خواهید کرد :
#lxc-ls —fancy centos01
NAME STATE IPV4 IPV6 AUTOSTART
—————————————-
centos01 STOPPED – – NO
Cloning Containers
این قابلیت وجود دارد که از یک کانتینر clone تهیه کردوبرای اینکار برای مثال قصد داریم تا از کانتینر centos01 یک clone با نام centos02 تهیه کنیم.به همین خاطر کافیست تا این دستور را اجرا کرد :
#lxc-clone centos01 centos02
با احرای دستور بالا چیزی شبیه به این را در خروجی مشاهده خواهید کرد :
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Created container centos02 as copy of centos01
اکنون می توان کانتینر centos02 را start کرد :
#lxc-start -n centos02
و برای اتصال به آن نیز کافیست تا این دستور را اجرا کرد :
#lxc-console -n centos02
جهت خاموش کردن یک کانتینر نیز می توانید پس از ورود به آن دستور poweroff را اجرا نمایید.
گرفتن snapshot از یک کانتینر :
جهت snapshot گرفتن از یک کانتینر ابتدا کافیست تا این دستور را اجرا کنید :
#lxc-stop -n centos01
سپس این دستور را اجرا کنید :
#lxc-snapshot -n centos01
در ubuntu 15.04 فایل های snapshots در این مسیر ذخیره می شوند :
/var/lib/lxc/
در ubuntu 14.04 فایل های snapshots در این مسیر ذخیره می شوند :
/var/lib/lxcsnaps/
بازیابی Snapshots :
جهت بازیابی یک کانتینر از snapshot کافیست تا این دستور را اجرا کنید :
#lxc-snapshot -n centos01 -r snap0
حذف Containers :
جهت حذف کامل یک کانتینر از روی Host کافیست تا این دستور را اجرا کنید :
#lxc-destroy -n centos01
مدیریت Container ها با استفاده از پنل تحت وب LXC :
اگر تمایل به مدیرت LXC از طریق کنسول را ندارید.می توانید از LXC web panel استفاده کنید و به راحتی و با استفاده از یک مرورگر وب کانتینر های خود را مدیریت کنید.
جهت نصب LXC web panel این دستور را اجرا کنید :
#wget https://lxc-webpanel.github.io/tools/install.sh -O – | sudo bash
خروجی دستور بالا را در پایین مشاهده می کنید :
wget https://lxc-webpanel.github.io/tools/install.sh -O – | sudo bash
–۲۰۱۵-۰۶-۱۳ ۱۶:۵۲:۲۹– https://lxc-webpanel.github.io/tools/install.sh
Resolving lxc-webpanel.github.io (lxc-webpanel.github.io)… ۲۳٫۲۳۵٫۴۳٫۱۳۳
Connecting to lxc-webpanel.github.io (lxc-webpanel.github.io)|23.235.43.133|:80… connected.
HTTP request sent, awaiting response… ۲۰۰ OK
Length: ۲۶۷۸ (۲٫۶K) [application/octet-stream]
Saving to: STDOUT
۱۰۰%[===================================>] ۲,۶۷۸ –.-K/s in ۰s
_ _____ _ _ _
| | \ \ / / __| \ \ / / | | | \ | |
| | \ V / | \ \ /\ / /| | | |) |_ _ _ _| |
| | > <| | \ \/ \/ / _ \ ‘_ \ | _/ _` | ‘_ \ / _ \ |
| |__ / . \ |__ \ /\ / / |_) | | | | (_| | | | | / |
|__/_/ \_\_____| \/ \/ \___|_./ |_| \,_|_| |_|\___|_|
Automatic installer
۲۰۱۵-۰۶-۱۳ ۱۶:۵۲:۳۰ (۳۹۳ MB/s) – written to stdout [۲۶۷۸/۲۶۷۸]
Installing requirement…
+ Installing Python pip
.
.
.
.
.
Successfully installed flask Werkzeug Jinja2 markupsafe
Cleaning up…
Cloning LXC Web Panel…
Cloning into ‘/srv/lwp’…
remote: Counting objects: ۱۶۷, done.
Receiving objects: ۱۰۰% (۱۶۷/۱۶۷), ۱۴۸٫۸۵ KiB | ۰ bytes/s, done.
remote: Total ۱۶۷ (delta ۰), reused ۰ (delta ۰), pack-reused ۱۶۷
Resolving deltas: ۱۰۰% (۶۳/۶۳), done.
Checking connectivity… done.
Installation complete!
Adding /etc/init.d/lwp…
Done
Starting server…done.
Connect you on https://your-ip-address:5000/
برای دسترسی به LXC web panel کافیست تا یک مرورگر وب باز کرده و IP سرور خود با پورت ۵۰۰۰ را درون آن وارد کنید.
#lxc #container @unixmens
اکنون می توان کانتینر centos02 را start کرد :
#lxc-start -n centos02
و برای اتصال به آن نیز کافیست تا این دستور را اجرا کرد :
#lxc-console -n centos02
جهت خاموش کردن یک کانتینر نیز می توانید پس از ورود به آن دستور poweroff را اجرا نمایید.
گرفتن snapshot از یک کانتینر :
جهت snapshot گرفتن از یک کانتینر ابتدا کافیست تا این دستور را اجرا کنید :
#lxc-stop -n centos01
سپس این دستور را اجرا کنید :
#lxc-snapshot -n centos01
در ubuntu 15.04 فایل های snapshots در این مسیر ذخیره می شوند :
/var/lib/lxc/
در ubuntu 14.04 فایل های snapshots در این مسیر ذخیره می شوند :
/var/lib/lxcsnaps/
بازیابی Snapshots :
جهت بازیابی یک کانتینر از snapshot کافیست تا این دستور را اجرا کنید :
#lxc-snapshot -n centos01 -r snap0
حذف Containers :
جهت حذف کامل یک کانتینر از روی Host کافیست تا این دستور را اجرا کنید :
#lxc-destroy -n centos01
مدیریت Container ها با استفاده از پنل تحت وب LXC :
اگر تمایل به مدیرت LXC از طریق کنسول را ندارید.می توانید از LXC web panel استفاده کنید و به راحتی و با استفاده از یک مرورگر وب کانتینر های خود را مدیریت کنید.
جهت نصب LXC web panel این دستور را اجرا کنید :
#wget https://lxc-webpanel.github.io/tools/install.sh -O – | sudo bash
خروجی دستور بالا را در پایین مشاهده می کنید :
wget https://lxc-webpanel.github.io/tools/install.sh -O – | sudo bash
–۲۰۱۵-۰۶-۱۳ ۱۶:۵۲:۲۹– https://lxc-webpanel.github.io/tools/install.sh
Resolving lxc-webpanel.github.io (lxc-webpanel.github.io)… ۲۳٫۲۳۵٫۴۳٫۱۳۳
Connecting to lxc-webpanel.github.io (lxc-webpanel.github.io)|23.235.43.133|:80… connected.
HTTP request sent, awaiting response… ۲۰۰ OK
Length: ۲۶۷۸ (۲٫۶K) [application/octet-stream]
Saving to: STDOUT
۱۰۰%[===================================>] ۲,۶۷۸ –.-K/s in ۰s
_ _____ _ _ _
| | \ \ / / __| \ \ / / | | | \ | |
| | \ V / | \ \ /\ / /| | | |) |_ _ _ _| |
| | > <| | \ \/ \/ / _ \ ‘_ \ | _/ _` | ‘_ \ / _ \ |
| |__ / . \ |__ \ /\ / / |_) | | | | (_| | | | | / |
|__/_/ \_\_____| \/ \/ \___|_./ |_| \,_|_| |_|\___|_|
Automatic installer
۲۰۱۵-۰۶-۱۳ ۱۶:۵۲:۳۰ (۳۹۳ MB/s) – written to stdout [۲۶۷۸/۲۶۷۸]
Installing requirement…
+ Installing Python pip
.
.
.
.
.
Successfully installed flask Werkzeug Jinja2 markupsafe
Cleaning up…
Cloning LXC Web Panel…
Cloning into ‘/srv/lwp’…
remote: Counting objects: ۱۶۷, done.
Receiving objects: ۱۰۰% (۱۶۷/۱۶۷), ۱۴۸٫۸۵ KiB | ۰ bytes/s, done.
remote: Total ۱۶۷ (delta ۰), reused ۰ (delta ۰), pack-reused ۱۶۷
Resolving deltas: ۱۰۰% (۶۳/۶۳), done.
Checking connectivity… done.
Installation complete!
Adding /etc/init.d/lwp…
Done
Starting server…done.
Connect you on https://your-ip-address:5000/
برای دسترسی به LXC web panel کافیست تا یک مرورگر وب باز کرده و IP سرور خود با پورت ۵۰۰۰ را درون آن وارد کنید.
#lxc #container @unixmens
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Forwarded from Academy and Foundation unixmens | Your skills, Your future
LXD is a next generation system container manager.
It offers a user experience similar to virtual machines but using Linux containers instead.
It's image based with pre-made images available for a wide number of Linux distributions
and is built around a very powerful, yet pretty simple, REST API.
#lxd #container @unixmens
It offers a user experience similar to virtual machines but using Linux containers instead.
It's image based with pre-made images available for a wide number of Linux distributions
and is built around a very powerful, yet pretty simple, REST API.
#lxd #container @unixmens
Forwarded from Academy and Foundation unixmens | Your skills, Your future
برای تست آنلاین میتونید از این لینک استفاده کنید : https://linuxcontainers.org/lxd/try-it/
Forwarded from Academy and Foundation unixmens | Your skills, Your future
Design
The core of LXD is a privileged daemon which exposes a REST API over a local unix socket
as well as over the network (if enabled).
Clients, such as the command line tool provided with LXD itself then do everything through that REST API.
It means that whether you're talking to your local host or a remote server, everything works the same way.
Features
Some of the biggest features of LXD are:
Secure by design (unprivileged containers, resource restrictions and much more)
Scalable (from containers on your laptop to thousand of compute nodes)
Intuitive (simple, clear API and crisp command line experience)
Image based (with a wide variety of Linux distributions published daily)
Support for Cross-host container and image transfer (including live migration with CRIU)
Advanced resource control (cpu, memory, network I/O, block I/O, disk usage and kernel resources)
Device passthrough (USB, GPU, unix character and block devices, NICs, disks and paths)
Network management (bridge creation and configuration, cross-host tunnels, ...)
Storage management (support for multiple storage backends, storage pools and storage volumes)
Integration with OpenStack
The "nova-lxd" project provides an OpenStack Nova plugin that seemlessly integrates
system containers into a regular OpenStack deployment.
With this, users will either get a virtual machine or a container, simply depending on what image or
instance type they select. It's completely transparent and works with the regular OpenStack APIs.
To learn more about LXD and OpenStack, take a look at our getting started with OpenStack page.
Availability
LXD works on any recent Linux distribution. LXD upstream directly maintains the Ubuntu packages
and also publishes a snap package which can be used with most of the popular Linux distributions.
The core of LXD is a privileged daemon which exposes a REST API over a local unix socket
as well as over the network (if enabled).
Clients, such as the command line tool provided with LXD itself then do everything through that REST API.
It means that whether you're talking to your local host or a remote server, everything works the same way.
Features
Some of the biggest features of LXD are:
Secure by design (unprivileged containers, resource restrictions and much more)
Scalable (from containers on your laptop to thousand of compute nodes)
Intuitive (simple, clear API and crisp command line experience)
Image based (with a wide variety of Linux distributions published daily)
Support for Cross-host container and image transfer (including live migration with CRIU)
Advanced resource control (cpu, memory, network I/O, block I/O, disk usage and kernel resources)
Device passthrough (USB, GPU, unix character and block devices, NICs, disks and paths)
Network management (bridge creation and configuration, cross-host tunnels, ...)
Storage management (support for multiple storage backends, storage pools and storage volumes)
Integration with OpenStack
The "nova-lxd" project provides an OpenStack Nova plugin that seemlessly integrates
system containers into a regular OpenStack deployment.
With this, users will either get a virtual machine or a container, simply depending on what image or
instance type they select. It's completely transparent and works with the regular OpenStack APIs.
To learn more about LXD and OpenStack, take a look at our getting started with OpenStack page.
Availability
LXD works on any recent Linux distribution. LXD upstream directly maintains the Ubuntu packages
and also publishes a snap package which can be used with most of the popular Linux distributions.
Forwarded from Academy and Foundation unixmens | Your skills, Your future (yashar esmaildokht 🐧)
Forwarded from Academy and Foundation unixmens | Your skills, Your future (yashar esmaildokht 🐧)
Forwarded from Academy and Foundation unixmens | Your skills, Your future (yashar esmaildokht 🐧)
This is a book about Docker, hand-crafted for system administrators. No prior
knowledge required!
But what about developers and DevOps?
If you’re a developer with no interest in operations then this book is not for you. If
you’re into DevOps then I think you’ll get a lot form the book.
To keep things short... the book is not about showing you how to develop microser-
vice apps with Docker. The book is about how the core Docker plumbing works.
You’ll learn the how and the why - the commands and the deep-dives. I really want
to set you on your way to being as good at Docker as you already are at Linux,
Windows or VMware.
Why should I read this book or care about
Docker?
Docker is coming and there’s no hiding from it. Developers are all over it. In IT Ops,
we need to get ready to support Dockerized apps in our business critical production
environments.
Isn’t Docker just for developers?
Hell no!!!
All of those Dockerized apps that developers are creating need a solid Docker
infrastructure to run on. And that’s where IT Ops comes into the picture... IT
Ops will be asked to build and run high performance and highly available Docker
infrastructures to support business applications. If we’re not skilled-up on Docker,
we’re going to struggle.
knowledge required!
But what about developers and DevOps?
If you’re a developer with no interest in operations then this book is not for you. If
you’re into DevOps then I think you’ll get a lot form the book.
To keep things short... the book is not about showing you how to develop microser-
vice apps with Docker. The book is about how the core Docker plumbing works.
You’ll learn the how and the why - the commands and the deep-dives. I really want
to set you on your way to being as good at Docker as you already are at Linux,
Windows or VMware.
Why should I read this book or care about
Docker?
Docker is coming and there’s no hiding from it. Developers are all over it. In IT Ops,
we need to get ready to support Dockerized apps in our business critical production
environments.
Isn’t Docker just for developers?
Hell no!!!
All of those Dockerized apps that developers are creating need a solid Docker
infrastructure to run on. And that’s where IT Ops comes into the picture... IT
Ops will be asked to build and run high performance and highly available Docker
infrastructures to support business applications. If we’re not skilled-up on Docker,
we’re going to struggle.
Forwarded from Academy and Foundation unixmens | Your skills, Your future (yashar esmaildokht 🐧)
پیاده سازی مفهوم DevOps با OpenShift :
برای بسیاری از سازمان ها، بخش بزرگی از درخواست DevOps، اتوماسیون نرم افزاری است که با استفاده از تکنیک های زیرساختی قابل پیاذه سازی است این کتاب ارائه دهنده ها، معماران، و مهندسین مابقی را با یک گزینه عملی تر ارائه می دهد. شما خواهید آموخت که چگونه یک رویکرد کانتینر از OpenShift می تواند به تیم شما کمک کند تا از طریق نمایه خدمات خود از زیرساخت IT به نرم افزارهای با کیفیت برسید .
🌈🌈🌈سه کارشناس OpenShift در Red Hat توضیح می دهند که چگونه نرم افزار Docker و مدیر خوشه ای Kubernetas را با ابزار توسعه و عملیاتی OpenShift پیکربندی کنید. کشف این که چگونه این پلتفرم مدیریت ظرفیت زیرساختی-اگنوستیک میتواند به شرکتها کمک کند تا به ناحیه تاریک که در آن زیرساختها به عنوان کد پایان مییابد و برنامه های کاربردی از آن شروع شود کمک کند.
در این کتاب می خوانید :
دیدگاه برنامه کاربردی برای اتوماسیون را بدست آورید و درک کنید که چرا مهم است
پیاده سازی خطوط یکپارچه پیوسته با قابلیت Jenkins OpenShift
کاوش مکانیزم برای جداسازی و مدیریت پیکربندی از نرم افزار زمان اجرا استاتیک
یاد بگیرید چگونه با استفاده از قابلیت Open-Shift سفارشی کنید
و ...
درباره نویسندگان
استفانو پیکززینی
استفانو پیکززینی پلت فرم Red Hat را به عنوان یک راه حل سرویس (PaaS) در سراسر استرالیا و نیوزلند هدایت می کند. او متخصص در پلت فرم کانتینر OpenShift Red Hat است.
مایک هپبورن
مایک هپبورن، متخصص موضوع ANZ PaaS در Red Hat، زمینه ای در معماری نرم افزار و ادغام و عملیات میان افزار دارد.
نوئل اوکانر
نوئل اوکانر مشاور و معمار اصلی در Red Hat است. او دارای تجربه گسترده ای در پیشبرد و ارائه پروژه های کلیدی مشتری برای مشتریان Red Hat در سراسر اروپا و مناطق آسیا اقیانوس آرام است.
https://www.dropbox.com/s/sy3iaoh65qke54c/Devops_With_Openshift.pdf?dl=0
#openshift #container #linux #devops @unixmens
برای بسیاری از سازمان ها، بخش بزرگی از درخواست DevOps، اتوماسیون نرم افزاری است که با استفاده از تکنیک های زیرساختی قابل پیاذه سازی است این کتاب ارائه دهنده ها، معماران، و مهندسین مابقی را با یک گزینه عملی تر ارائه می دهد. شما خواهید آموخت که چگونه یک رویکرد کانتینر از OpenShift می تواند به تیم شما کمک کند تا از طریق نمایه خدمات خود از زیرساخت IT به نرم افزارهای با کیفیت برسید .
🌈🌈🌈سه کارشناس OpenShift در Red Hat توضیح می دهند که چگونه نرم افزار Docker و مدیر خوشه ای Kubernetas را با ابزار توسعه و عملیاتی OpenShift پیکربندی کنید. کشف این که چگونه این پلتفرم مدیریت ظرفیت زیرساختی-اگنوستیک میتواند به شرکتها کمک کند تا به ناحیه تاریک که در آن زیرساختها به عنوان کد پایان مییابد و برنامه های کاربردی از آن شروع شود کمک کند.
در این کتاب می خوانید :
دیدگاه برنامه کاربردی برای اتوماسیون را بدست آورید و درک کنید که چرا مهم است
پیاده سازی خطوط یکپارچه پیوسته با قابلیت Jenkins OpenShift
کاوش مکانیزم برای جداسازی و مدیریت پیکربندی از نرم افزار زمان اجرا استاتیک
یاد بگیرید چگونه با استفاده از قابلیت Open-Shift سفارشی کنید
و ...
درباره نویسندگان
استفانو پیکززینی
استفانو پیکززینی پلت فرم Red Hat را به عنوان یک راه حل سرویس (PaaS) در سراسر استرالیا و نیوزلند هدایت می کند. او متخصص در پلت فرم کانتینر OpenShift Red Hat است.
مایک هپبورن
مایک هپبورن، متخصص موضوع ANZ PaaS در Red Hat، زمینه ای در معماری نرم افزار و ادغام و عملیات میان افزار دارد.
نوئل اوکانر
نوئل اوکانر مشاور و معمار اصلی در Red Hat است. او دارای تجربه گسترده ای در پیشبرد و ارائه پروژه های کلیدی مشتری برای مشتریان Red Hat در سراسر اروپا و مناطق آسیا اقیانوس آرام است.
https://www.dropbox.com/s/sy3iaoh65qke54c/Devops_With_Openshift.pdf?dl=0
#openshift #container #linux #devops @unixmens
Dropbox
Devops_With_Openshift.pdf
Shared with Dropbox
Forwarded from Academy and Foundation unixmens | Your skills, Your future (yashar esmaildokht 🐧)
فیلم آموزشی 1:30 ساعته پروسس ها
مدرس : مهندس یاشار اسمعیل دخت
https://zarinp.al/234624
در این آموزش به بررسی و مدیریت فرایند ها در یونیکس بیس ها پرداخته ایم .
مدرس : مهندس یاشار اسمعیل دخت
https://zarinp.al/234624
در این آموزش به بررسی و مدیریت فرایند ها در یونیکس بیس ها پرداخته ایم .
zarinp.al
درگاه پرداخت اینترنتی زرینپال
گذرگاه تراکنشهای مالی امن
Academy and Foundation unixmens | Your skills, Your future
فیلم آموزشی 1:30 ساعته پروسس ها مدرس : مهندس یاشار اسمعیل دخت https://zarinp.al/234624 در این آموزش به بررسی و مدیریت فرایند ها در یونیکس بیس ها پرداخته ایم .
چطور میتوان حجم استفاده شده یک فرایند از مموری را فهمید ؟
چطور میتوان ساختار سفارشی سازی برای اطلاعات فرایند ها داشت ؟
چطور میتوان فهمید کدام cpu core بیشتر استفاده میشود ؟
انواع ساختار فیلترینگ در پروسس ها
انواع وضعیت فرآیند ها
فرایندهای zombie چیست ؟
فرایند های foreground و background چیست ؟
و مطالب دیگر ...
چطور میتوان ساختار سفارشی سازی برای اطلاعات فرایند ها داشت ؟
چطور میتوان فهمید کدام cpu core بیشتر استفاده میشود ؟
انواع ساختار فیلترینگ در پروسس ها
انواع وضعیت فرآیند ها
فرایندهای zombie چیست ؟
فرایند های foreground و background چیست ؟
و مطالب دیگر ...
Forwarded from Academy and Foundation unixmens | Your skills, Your future (yashar esmaildokht 🐧)
کانال @unixmens کانالی برای ارتقا ساختار سازمانی و کارایی بالا بر مبنای تجارت و راهکار های متن باز و گنو/لینوکس می باشد ،این کانال کانالی در حوزه های مختلف IT است. کانال خود را به دیگران معرفی کنید .