User talk:Mattx86
Install Alpine to a HDD quickly, with networking, updated APK, upgraded system, ssh, bash, nano, iputils, ircii, alpine-sdk, a new user, and aports.
- Start out by creating a new file called
myconf.sh
on your workstation. - Fill it with the following shell script, review it, and modify it accordingly.
- Boot up the Alpine Linux CD/ISO.
- Run 'setup-disk' and reboot into system.
- Get this file onto your system (e.g. by local networking or a USB stick)
- As root:
chmod +x myconf.sh && ./myconf.sh
#!/bin/sh # Change root password ### NOTE: AS IS, THIS WILL PROMPT FOR A PASSWORD. passwd # Setup Hostname echo "alpinevm.lan" > /etc/hostname echo -en "127.0.0.1\tlocalhost.localdomain\tlocalhost\n" > /etc/hosts echo -en "::1\tlocalhost.localdomain\tlocalhost\tipv6-localhost\tipv6-loopback\n" >> /etc/hosts echo -en "10.0.0.2\talpinevm.lan\talpinevm\n" >> /etc/hosts echo -en "2001:470:ffff:ff::2\talpinevm.lan\talpinevm\n" >> /etc/hosts hostname -F /etc/hostname # IPv4 and IPv6 Configuration for eth0 echo -en "auto lo\n\ iface lo inet loopback\n\ \n\ auto eth0\n\ iface eth0 inet static\n\ address 10.0.0.2\n\ netmask 255.255.255.0\n\ gateway 10.0.0.1\n\ \n\ iface eth0 inet6 static\n\ address 2001:470:ffff:ff::2\n\ netmask 64\n\ gateway 2001:470:ffff:ff::1\n" > /etc/network/interfaces chown root:root /etc/network/interfaces chmod 644 /etc/network/interfaces # Name Server Configuration echo "nameserver 8.8.8.8" > /etc/resolv.conf echo "nameserver 8.8.4.4" >> /etc/resolv.conf # Configure IPv6 module to load on boot, and load it now. echo "ipv6" >> /etc/modules modprobe ipv6 # Bring up networking /etc/init.d/networking restart # Add acpid and cron to startup, and start them up. rc-update -q add acpid rc-update -q add cron /etc/init.d/acpid restart /etc/init.d/cron restart # Configure apk repositories echo "http://dl-4.alpinelinux.org/alpine/v2.0/packages/main/" > /etc/apk/repositories echo "http://dl-4.alpinelinux.org/alpine/v2.0/packages/testing/" >> /etc/apk/repositories # Update apk package list and upgrade system. apk update apk upgrade # Install the software we need apk add bkeymaps openssh bash nano iputils ircii alpine-sdk # Setup Keymap (requires package bkeymaps) /sbin/setup-keymap # Change root's shell to bash sed -ri 's;^(root:x:0:0:root:/root:)/bin/sh;\1/bin/bash;' /etc/passwd # Add user account addgroup newuser adduser -s /bin/bash -G newuser newuser ### NOTE: AS IS, THIS WILL PROMPT FOR A PASSWORD. # Configure the new account for sudo sed -ri 's/(wheel:x:10:root)/\1,newuser/' /etc/group sed -ri 's/# %wheel\tALL=\(ALL\) ALL/%wheel\tALL=\(ALL\) ALL/' /etc/sudoers # Configure the new account for git su -s /bin/bash -c "git config --global user.name \"Your Full Name\"" newuser su -s /bin/bash -c "git config --global user.email \"your@email.address\"" newuser # Clone aports tree git clone git://git.alpinelinux.org/aports /usr/aports chown -R root:wheel /usr/aports chmod -R 774 /usr/aports # Configure abuild.conf and generate security keys for abuild sed -i 's/#PACKAGER="Your Name <your@email.address>"/PACKAGER="Your Name <your@email.address>"/' /etc/abuild.conf su -s /bin/bash -c "abuild-keygen -a -i" newuser ### NOTE: AS IS, THIS WILL PROMPT FOR WHERE TO SAVE THE KEY AND THE USER'S PASSWORD. # Configure openssh to start on boot, allow root access, turn off DNS usage, and start it up. rc-update add sshd sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config sed -i 's/^#UseDNS.*/UseDNS no/' /etc/ssh/sshd_config /etc/init.d/sshd restart # Exit and log back in for bash. echo "Log back in for bash." exit