Alpine Linux for beginners...

Alpine linux, from their website, is a security-oriented, lightweight Linux distribution based on musl libc and busybox. I don't 100% know what that means, so here's their site 😄
about | Alpine Linux — Alpine Linux
To kick this off, we are going to install Apline on Proxmox, do some basic configurations, install the Alpine Configuration Framework, install and configure Wordpress with lighttpd, mariadb and php, then tie it off with a simple Samba share.
Install Alpine Linux on Proxmox
You can deploy with the resources you wish, however, for this I'll be using 32Gb Disk, 1vCPU, 2Gb RAM.
Once the VM is booted, you'll be asked to login. Typically just type root and hit enter. You should be logged in.
Now you can run the setup process. Run the command:
setup-alpineFrom that script, you'll be asked a series of questions. I'd like to eventually develop an answerfile for this as most of my stuff is the same across the board. Here are the answers I used:
keymap: us usOnce the setup finishes, it'll ask you to reboot. Since I went with the sys install mode, I'll remove the ISO from the VM before.
hostname: alpinevm
interfaces: eth0
networking: dhcp
root password: 'somethingstrong'
timezone: America/Chicago
fqdn: alpinevm.domain.tld
proxy: none
repos: c r
user: no
ssh: openssh
disk: sda
install mode: sys
Get logged back into the VM through Proxmox console.
For this example only, I'm allowing password login via root on the VM by modifying /etc/ssh/sshd_config.
AllowRootLogin yesAt this point you can now SSH to the VM to work with it. It's a functioning Alpine OS VM with no services at this time.
Alpine Configuration Framework
I'm not a linux guru by any stretch of the imagination, so I've relied on other tools to help me at least visualize or read data from linux systems in the past to aid in configurations. Many times that was Webmin/Virtualmin. You can run Webmin on Alpine but it's a bit of a hack and I don't recomend it. Aline ships with a WebUI of sorts that may help you to get started. That's called the Alpine Configuration Framework (AFK).
To install ACF, simply run the command:
setup-acfBy default the mini_httpd server runs on port 443, so I'll update that to run on port 10443. Modify /etc/mini_httpd/mini_httpd.conf to to show port 10443 instead of 443 and restart the mini_httpd service:
service mini_httpd restartNow open a browser to https://<yourvmip>:10443 and login with root.
Wordpress
Wordpress, while being a huge player in the Web CMS game, is also super easy to use and a great starting point for your new website/blog. To deploy Wordpress, we will install lighttpd, mariadb, php, and more to get it all up and running.
Install lighttpd and php packages:
apk add lighttpd php82 fcgi php82-cgi php82-mysqli php82-session php82-mbstring php82-gettextConfigure LighttpdEdit /etc/lighttpd/lighttpd.conf and uncomment the line:
include "mod_fastcgi.conf"Edit /etc/lighttpd/mod_fastcgi.conf, find and change /usr/bin/php-cgi to /usr/bin/php-cgi82 so it looks like the line below:
"bin-path" => "/usr/bin/php-cgi82" # php-cgiStart lighttpd service and add it to default runlevel:
rc-service lighttpd startInstall extra packages:
rc-update add lighttpd default
apk add wget mariadb mariadb-client php82-mysqliRestart Lighttpd:
rc-service lighttpd restartWordpressDownload and deploy the latest version of Wordpress:
mkdir -p /var/www/wordpresscd /var/wwwSet folder permissions and create a symlink for easy navigation:
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rm latest.tar.gz
chown -R lighttpd /var/www/wordpressConfig and start MySql
ln -s /var/www/wordpress/ /var/www/localhost/htdocs/wordpress/etc/init.d/mariadb setupCreate the WordPress database
rc-service mariadb start && rc-update add mariadb default
/usr/bin/mariadb-admin -u root password 'somethingstrong'mysql -u root -pCREATE DATABASE wordpress;Install WordPressBrowse to http://ipaddress/wordpress/.
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'anotherstrongpassword';
FLUSH PRIVILEGES;
EXIT
From here you simply answer the questions. Mine ended up like:
database: wordpressClick next and you have a page of more questions, mine were:
db user: wordpress
db pass: 'anotherstrongpassword'
db server: localhost
Site Title: my awesome websiteClick Install and you have a functioning installation of Wordpress.
Username: myemailaddress
Password: 'strongpassword'
E-Mail: myemailaddress
Samba (SMB Share)
In keeping with the example here, we'll create a data folder as our Samba/SMB Share.
Install Samba
apk add sambaNow you could create a directory for your share.
mkdir /var/samba/dataAlpine already gives you a smb.conf so we can run the command to move it out the way for now:
chmod 0777 /var/samba/data
mv /etc/samba/smb.conf /etc/samba/smb.conf.bakNow you can create your own smb.conf with the following contents:
[global]Now let's create some usernames (create the same user/pass 2x) with the following:
workgroup = WORKGROUP
server string = ALPINE LINUX ALPINEVM
server role = standalone server
hosts allow = 192.168.254.0/24
log file = /var/log/samba/%m.log
max log size = 50
[data]
path = /var/samba/data
comment = Default Data Share
follow symlinks = yes
wide links = yes
writeable = yes
adduser usernameFinish by starting samba and setting it up to start at boot:
smbpasswd -a username
rc-update add sambaAll done. Now you can navigate to \ipaddress\data to access your share with the user/pass you created. Possibly bad advice: create the same user/pass combo your workstation is using to access the samba share (i.e. usernamexyz/passwordabc on Windows 10 and usernamexyz/passwordabc on Alpine/Samba).
rc-service samba start
