User talk:Mattx86: Difference between revisions

From Alpine Linux
No edit summary
(Blanked the page)
 
(7 intermediate revisions by the same user not shown)
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.
<pre>#!/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" &gt; /etc/hostname
echo -e "127.0.0.1\tlocalhost.localdomain\tlocalhost\n" &gt; /etc/hosts
echo -e "::1\tlocalhost.localdomain\tlocalhost\tipv6-localhost\tipv6-loopback\n" &gt;&gt; /etc/hosts
echo -e "10.0.0.2\talpinevm.lan\talpinevm\n" &gt;&gt; /etc/hosts
echo -e "2001:470:ffff:ff::2\talpinevm.lan\talpinevm\n" &gt;&gt; /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" &gt; /etc/network/interfaces
chown root:root /etc/network/interfaces
chmod 644 /etc/network/interfaces
# Name Server Configuration
echo "nameserver 8.8.8.8" &gt; /etc/resolv.conf
echo "nameserver 8.8.4.4" &gt;&gt; /etc/resolv.conf
# Configure IPv6 module to load on boot, and load it now.
echo "ipv6" &gt;&gt; /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/" &gt; /etc/apk/repositories
echo "http://dl-4.alpinelinux.org/alpine/v2.0/packages/testing/" &gt;&gt; /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 &lt;your@email.address&gt;"/PACKAGER="Your Name &lt;your@email.address&gt;"/' /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</pre>

Latest revision as of 17:56, 31 October 2010