User talk:Mattx86: Difference between revisions
(Created page with 'Install Alpine to a HDD quickly, with networking, updated APK, upgraded system, ssh, bash, nano, iputils, ircii, alpine-sdk, a new user, and aports. <nowiki>#!/bin/sh ######### ...') |
No edit summary |
||
| Line 1: | Line 1: | ||
Install Alpine to a HDD quickly, with networking, updated APK, upgraded system, ssh, bash, nano, iputils, ircii, alpine-sdk, a new user, and aports. | Install Alpine to a HDD quickly, with networking, updated APK, upgraded system, ssh, bash, nano, iputils, ircii, alpine-sdk, a new user, and aports. | ||
< | <pre>#!/bin/sh | ||
######### | ######### | ||
| Line 21: | Line 21: | ||
# Setup Hostname | # Setup Hostname | ||
echo "alpinevm.lan" | echo "alpinevm.lan" > /etc/hostname | ||
echo -e "127.0.0.1\tlocalhost.localdomain\tlocalhost\n" | echo -e "127.0.0.1\tlocalhost.localdomain\tlocalhost\n" > /etc/hosts | ||
echo -e "::1\tlocalhost.localdomain\tlocalhost\tipv6-localhost\tipv6-loopback\n" | echo -e "::1\tlocalhost.localdomain\tlocalhost\tipv6-localhost\tipv6-loopback\n" >> /etc/hosts | ||
echo -e "10.0.0.2\talpinevm.lan\talpinevm\n" | echo -e "10.0.0.2\talpinevm.lan\talpinevm\n" >> /etc/hosts | ||
echo -e "2001:470:ffff:ff::2\talpinevm.lan\talpinevm\n" | echo -e "2001:470:ffff:ff::2\talpinevm.lan\talpinevm\n" >> /etc/hosts | ||
hostname -F /etc/hostname | hostname -F /etc/hostname | ||
| Line 41: | Line 41: | ||
address 2001:470:ffff:ff::2\n\ | address 2001:470:ffff:ff::2\n\ | ||
netmask 64\n\ | netmask 64\n\ | ||
gateway 2001:470:ffff:ff::1\n" | gateway 2001:470:ffff:ff::1\n" > /etc/network/interfaces | ||
chown root:root /etc/network/interfaces | chown root:root /etc/network/interfaces | ||
chmod 644 /etc/network/interfaces | chmod 644 /etc/network/interfaces | ||
# Name Server Configuration | # Name Server Configuration | ||
echo "nameserver 8.8.8.8" | echo "nameserver 8.8.8.8" > /etc/resolv.conf | ||
echo "nameserver 8.8.4.4" | echo "nameserver 8.8.4.4" >> /etc/resolv.conf | ||
# Configure IPv6 module to load on boot, and load it now. | # Configure IPv6 module to load on boot, and load it now. | ||
echo "ipv6" | echo "ipv6" >> /etc/modules | ||
modprobe ipv6 | modprobe ipv6 | ||
| Line 63: | Line 63: | ||
# Configure apk repositories | # Configure apk repositories | ||
echo "http://dl-4.alpinelinux.org/alpine/v2.0/packages/main/" | 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/" | echo "http://dl-4.alpinelinux.org/alpine/v2.0/packages/testing/" >> /etc/apk/repositories | ||
# Update apk package list and upgrade system. | # Update apk package list and upgrade system. | ||
| Line 102: | Line 102: | ||
# Configure abuild.conf and generate security keys for abuild | # Configure abuild.conf and generate security keys for abuild | ||
sed -i 's/#PACKAGER="Your Name | 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 | 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. | ### NOTE: AS IS, THIS WILL PROMPT FOR WHERE TO SAVE THE KEY AND THE USER'S PASSWORD. | ||
| Line 108: | Line 108: | ||
# Exit and log back in for bash. | # Exit and log back in for bash. | ||
echo "Log back in for bash." | echo "Log back in for bash." | ||
exit</ | exit</pre> | ||
Revision as of 17:12, 6 August 2010
Install Alpine to a HDD quickly, with networking, updated APK, upgraded system, ssh, bash, nano, iputils, ircii, alpine-sdk, a new user, and aports.
#!/bin/sh
#########
# Directions:
# 1. Boot up the Alpine Linux CD/ISO.
# 2. setup-disk and reboot into system.
# 3. Get this file onto your system (e.g. by local networking or a USB stick)
# 4. chmod +x myconf.sh && ./myconf.sh as root
#########
# Setup Keymap
#/sbin/setup-keymap
### THIS REQUIRES MISSING PACKAGE 'bkeymaps'
### ONCE 'bkeymaps' IS IN THE DEFAULT INSTALL,
### THIS SHOULD BE DONE WITHOUT PROMPTING (FOR UNATTENDED INSTALLS).
# Change root password
### NOTE: AS IS, THIS WILL PROMPT FOR A PASSWORD.
passwd
# Setup Hostname
echo "alpinevm.lan" > /etc/hostname
echo -e "127.0.0.1\tlocalhost.localdomain\tlocalhost\n" > /etc/hosts
echo -e "::1\tlocalhost.localdomain\tlocalhost\tipv6-localhost\tipv6-loopback\n" >> /etc/hosts
echo -e "10.0.0.2\talpinevm.lan\talpinevm\n" >> /etc/hosts
echo -e "2001:470:ffff:ff::2\talpinevm.lan\talpinevm\n" >> /etc/hosts
hostname -F /etc/hostname
# IPv4 and IPv6 Configuration for eth0
echo -e "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 openssh, configure it to start on boot, allow root access, and start it up.
apk add openssh
rc-update add sshd
sed -i 's/^#PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/^#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
/etc/init.d/sshd restart
# Install some extra software
apk add bash nano iputils ircii alpine-sdk
# 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.
# Exit and log back in for bash.
echo "Log back in for bash."
exit