Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a alpine linux latest-stable 3.10.2 x86_64 on CentOS 6 with elrepo kernel x86_64 #5

Open
ghost opened this issue May 23, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented May 23, 2017

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-6-9.el6.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-lt
TO=/alpine
yum install git
swapoff -a
mkdir $TO
mount -t tmpfs tmpfs $TO
git clone https://github.com/marcan/takeover.sh $TO
cd $TO
curl -L https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-x86_64 > busybox
curl -L http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/alpine-minirootfs-3.10.2-x86_64.tar.gz|gzip -dc|tar xv
cp /etc/resolv.conf etc
cp -a /lib/modules lib
cp /etc/sysconfig/network-scripts/ifcfg-eth0 ./
sed -i 's/bin\/passwd/usr\/bin\/passwd/g' takeover.sh
chroot . /bin/ash
apk update&&apk add openssh-server shadow tmux bash alpine-sdk&&gcc /fakeinit.c -o /fakeinit&&apk del alpine-sdk
echo PermitRootLogin yes >>/etc/ssh/sshd_config
#exec part of init (cannot use telinit)

PORT=$RANDOM
echo $PORT
chmod +x busybox
./busybox mkdir -p old_root
./busybox mount -t tmpfs tmp tmp
./busybox mount -t proc proc proc
./busybox mount -t sysfs sys sys
#./busybox mount -t devtmpfs devtmpfs dev
if ! ./busybox mount -t devpts devpts /dev/pts; then
./busybox mount -t tmpfs dev dev
./busybox cp -a /dev/* dev/
./busybox rm -rf dev/pts
./busybox mkdir dev/pts
fi
mkdir dev/pts
./busybox mount -t devpts devpts dev/pts
/usr/bin/passwd#cp -a /root/.ssh/ $TO/root/&&chroot $TO /bin/ash
/usr/bin/ssh-keygen -A
/usr/sbin/sshd -p $PORT
logout

./busybox mount --make-rprivate /
./busybox pivot_root . old_root

this part
and "reboot" let init re-excuting init
(aftre kill all of old_root process)
umount /old_root/dev/pts
umount /old_root/dev/shm
umount /old_root/dev
umount -l /old_root/proc
umount -l /old_root/sys
rm /dev/null
umount -l /old_root
mknod -m 666 /dev/null c 1 3

@ghost ghost changed the title alpine linux way add a alpine linux way 3.5.2 x86_64 May 23, 2017
@ghost ghost changed the title add a alpine linux way 3.5.2 x86_64 add a alpine linux way 3.6.0 x86_64 May 29, 2017
@ghost ghost changed the title add a alpine linux way 3.6.0 x86_64 add a alpine linux way 3.6.0 x86_64 on CentOS 6 Jun 11, 2017
@ghost ghost changed the title add a alpine linux way 3.6.0 x86_64 on CentOS 6 add a alpine linux way 3.6.1 x86_64 on CentOS 6 Jun 11, 2017
@ghost ghost changed the title add a alpine linux way 3.6.1 x86_64 on CentOS 6 add a alpine linux way 3.7.0 x86_64 on CentOS 6 Dec 31, 2017
@moralrebuild
Copy link

does it work or not?

@ghost
Copy link
Author

ghost commented Jul 11, 2019

does it work or not?

yes.

@ghost ghost changed the title add a alpine linux way 3.7.0 x86_64 on CentOS 6 add a alpine linux latest-stable 3.10 x86_64 on CentOS 6 Jul 11, 2019
@ghost ghost changed the title add a alpine linux latest-stable 3.10 x86_64 on CentOS 6 add a alpine linux latest-stable 3.10.2 x86_64 on CentOS 6 Oct 10, 2019
@ghost ghost changed the title add a alpine linux latest-stable 3.10.2 x86_64 on CentOS 6 add a alpine linux latest-stable 3.10.2 x86_64 on CentOS 6 x86_64 Oct 10, 2019
@ghost ghost changed the title add a alpine linux latest-stable 3.10.2 x86_64 on CentOS 6 x86_64 add a alpine linux latest-stable 3.10.2 x86_64 on CentOS 6 with elrepo kernel x86_64 Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@moralrebuild and others