未加星标

Upgrading a Slackware instance on OpenVZ

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

I’ve just bought an OpenVZ VPS. Good news: the provider has a Slackware template! Bad news: it’s the same ancient Slackware 13.37 template that AlienBOB blogged about last year. See ‘Running Slackware 14.1 in an OpenVZ VPS’ at Alien Pastures .

Slackware 14.1

AlienBOB’s Slackware 14.1 template is available on openvz.org, see the ‘Contributed templates’ here: https://openvz.org/Download/template/precreated

What can you do if your VPS provider hasn’t made the Slackware 14.1 template available? You can download and install more network packages from Slackware 13.37, and then you can download and upgrade to 14.0, and then you can download and upgrade to 14.1. Obviously this is tedious and painful.

But there is a sneaky way of directly using the Slackware 14.1 template to upgrade a running Slackware 13.37 VPS.

First, please backup everything important to another system!

Now copy AlienBOB’s template into your VPS. For a new Slackware 13.37 VPS, you will have to download it to another system and then use scp to copy it into your VPS, because the 13.37 template is extremely minimalist, and ssh/scp is the only network tool that is installed.

When you have the template inside your vps, create a new directory and extract AlienBOB’s template into it. mkdir /new cd /new tar xf ~/slackware-14.1-x86_64-minimal-20150519.tar.xz

Now you need to customise some of the files in /new/etc/ here is what I did, but please use your head and do the right thing for your own system:

Edit /new/etc/rc.d/rc.inet1.conf, mine is now like this: IFNAME[0]="venet0" IPADDR[0]="31.7.184.118" NETMASK[0]="255.255.255.255" USE_DHCP[0]="" DHCP_HOSTNAME[0]="" GATEWAY="192.0.2.1" I got ipv6 working on the venet0 device, by adding this to /etc/rc.d/rc.local: ip -6 route add ::/0 dev venet0 ip -6 addr add 2a01:4a0:25::47a0:41fc dev venet0 Preserved some more files cp /etc/HOSTNAME /etc/hosts /new/etc/ cp /etc/ssh/ssh_host_* /new/etc/ssh/ cp /etc/passwd /etc/shadow /etc/group /new/etc/ Disabled system logging chmod ugo-x /new/etc/rc.d/rc.syslog

It turns out that my VPS provider re-edits /etc/inittab and /etc/rc.d/rc.inet1 on every reboot. Two getty entries are added to the end of /etc/inittab to support the VPS serial console, and /etc/rc.d/rc.inet1 is clumsily edited (probably with sed) to change all occurrences of ‘eth’ to ‘venet’, and to add an extra static route. It also turns out that this can be prevented by setting the ‘immutable’ flag on these files.

Now you can start the sneaky upgrade from 13.37 to 14.1. Bind-mount the real filesystem root into your new directory: mkdir /new/real mount --bind / /new/real Enter a chroot environment using your new directory: chroot /new Move the old directories out of the real root, and copy the new directories into the real root: mkdir /old for d in /bin /etc /lib* /sbin /usr /var ; do mv /real/$d /old/ cp -a $d /real/ done Exit the chroot. Hopefully you still have a working VPS! You can now delete /new, and reboot. Good luck! Slackware 14.2

You can simply install 14.1 as above, and then upgrade manually to 14.2. AlienBOB’s 14.1 template has all the required packages and is configured so that slackpkg will work properly.

The new version of /etc/rc.d/rc.S in 14.2 needs some changes, corresponding to AlienBOB’s rc.S in the 14.1 template. I’ve put a copy of my attempt here:rc.S.new

Alternatively, if you are feeling very confident, you can create your own Slackware 14.2 template, using AlienBOB’s script create_slackware_openvz_template.sh and Weber K.’s comment from Alien Pastures (see October 10, 2016 at 11:32).

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: SlackVPSDHCDHCP
分页:12
转载请注明
本文标题:Upgrading a Slackware instance on OpenVZ
本站链接:http://www.codesec.net/view/522752.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(23)