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 😄
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-alpine
From 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 us
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
Once 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.
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 yes
At 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-acf
By 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 restart
Now 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-gettext
Configure Lighttpd
Edit /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-cgi
Start lighttpd service and add it to default runlevel:
rc-service lighttpd start
rc-update add lighttpd default
Install extra packages:
apk add wget mariadb mariadb-client php82-mysqli
Restart Lighttpd:
rc-service lighttpd restart
Wordpress
Download and deploy the latest version of Wordpress:
mkdir -p /var/www/wordpress
cd /var/www
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rm latest.tar.gz
Set folder permissions and create a symlink for easy navigation:
chown -R lighttpd /var/www/wordpress
ln -s /var/www/wordpress/ /var/www/localhost/htdocs/wordpress
Config and start MySql
/etc/inid.d/mariadb setup
rc-service mariadb start && rc-update add mariadb default
/usr/bin/mariadb-admin -u root password 'somethingstrong'
Create the WordPress database
mysql -u root -p
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'anotherstrongpassword';
FLUSH PRIVILEGES;
EXIT
Install WordPress
Browse to http://ipaddress/wordpress/.
From here you simply answer the questions. Mine ended up like:
database: wordpress
db user: wordpress
db pass: 'anotherstrongpassword'
db server: localhost
Click next and you have a page of more questions, mine were:
Site Title: my awesome website
Username: myemailaddress
Password: 'strongpassword'
E-Mail: myemailaddress
Click Install and you have a functioning installation of Wordpress.
Samba (SMB Share)
In keeping with the example here, we'll create a data
folder as our Samba/SMB Share.
Install Samba
apk add samba
Now you could create a directory for your share.
mkdir /var/samba/data
chmod 0777 /var/samba/data
Alpine already gives you a smb.conf so we can run the command to move it out the way for now:
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Now you can create your own smb.conf with the following contents:
[global]
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
Now let's create some usernames (create the same user/pass 2x) with the following:
adduser username
smbpasswd -a username
Finish by starting samba and setting it up to start at boot:
# rc-update add samba
# rc-service samba start
All 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).
Comments ()