61 lines
1.1 KiB
Markdown
61 lines
1.1 KiB
Markdown
# 🏗️ Phase 5: Server Stuff
|
|
|
|
> Goal: Actually serve something — web server, NFS, file sharing
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 1 — Web Server
|
|
|
|
```bash
|
|
# Install nginx on alpine-1
|
|
apk add nginx
|
|
|
|
# Start it
|
|
rc-service nginx start
|
|
rc-update add nginx default
|
|
|
|
# Create a custom page
|
|
echo "<h1>Welcome to alpine-1!</h1>" > /var/www/localhost/htdocs/index.html
|
|
|
|
# Test from alpine-2
|
|
curl http://10.0.1.1/
|
|
|
|
# Check access logs
|
|
cat /var/log/nginx/access.log
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 2 — NFS File Sharing
|
|
|
|
```bash
|
|
# On alpine-1 (server):
|
|
apk add nfs-utils
|
|
mkdir /srv/shared
|
|
echo "/srv/shared 10.0.1.0/24(rw,sync,no_subtree_check)" > /etc/exports
|
|
rc-service nfs start
|
|
|
|
# On alpine-2 (client):
|
|
apk add nfs-utils
|
|
mkdir /mnt/shared
|
|
mount -t nfs 10.0.1.1:/srv/shared /mnt/shared
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 3 — Auto-mount with fstab
|
|
|
|
```bash
|
|
# Add to /etc/fstab on alpine-2:
|
|
echo "10.0.1.1:/srv/shared /mnt/shared nfs defaults 0 0" >> /etc/fstab
|
|
```
|
|
|
|
---
|
|
|
|
## ✅ Phase 5 Checklist
|
|
- [ ] Web server (nginx)
|
|
- [ ] NFS server + client
|
|
- [ ] Persistent mounts with fstab
|
|
|
|
**Previous:** [[Phase 4 - Security]] | **Next:** [[Phase 6 - Automation]]
|