Lab 1_ Configuring an Open-Source Linux Distribution for Machine Learning
Lab 1_ Configuring an Open-Source Linux Distribution for Machine Learning
Objectives:
td
3. Implement basic security configurations and configure a firewall.
tl
Prerequisites:
1. Linux Distribution: An installed open-source Linux distribution such as Ubuntu 20.04
Pv
LTS.
2. Root or Sudo Access: Ability to execute commands with root privileges.
3. Internet Connection: To download and install packages.
ng
Tasks:
```bash
sudo apt update
sudo apt upgrade -y
IE
```
```bash
sudo apt install python3 python3-pip -y
```
N
```bash
python3 --version
pip3 --version
```
```bash
pip3 install jupyter
```
```bash
jupyter notebook --generate-config
```
3. ```bash
td
jupyter notebook password
```
tl
```bash
Pv
jupyter notebook
```
ng
Step 2: Install Essential ML Libraries
1.
```bash
ni
ar
pip3 install numpy pandas matplotlib scikit-learn tensorflow keras torch
torchvision
Le
```
```bash
IE
python3
>>> import numpy, pandas, tensorflow as tf, torch
>>> print(numpy.__version__, pandas.__version__, tf.__version__,
AF
torch.__version__)
>>> exit()
```
N
AL
```bash
sudo adduser mluser
sudo usermod -aG sudo mluser
```
```bash
su - mluser
```
1. ```bash
ssh-keygen -t rsa -b 4096
td
```
tl
2. ```bash
ssh-copy-id mluser@your-server-ip
Pv
```
3. ```bash
ng
sudo nano /etc/ssh/sshd_config
```
- Set `PasswordAuthentication` to `no`.
ni
- Restart SSH service:
```bash
ar
sudo systemctl restart ssh
```
Le
1. ```bash
sudo apt install ufw -y
```
AF
2. ```bash
sudo ufw allow OpenSSH
N
```
AL
3. ```bash
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
```
4. ```bash
sudo ufw enable
```
5.```bash
sudo ufw status
```
td
sudo apt install fail2ban -y
```
tl
Pv
2. ```bash
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure --priority=low unattended-upgrades
ng
```
```bash
jupyter notebook
```
IE
Create a new notebook and run basic commands to check if all installed libraries are working.
- Ensure that only allowed services (SSH, HTTP, HTTPS) are accessible from outside.
- Attempt to access any blocked ports to confirm they are properly restricted.
N
Conclusion:
By following this lab, you've successfully configured an open-source Linux distribution tailored
AL
for machine learning development. You've installed Python, Jupyter, and essential ML libraries
while implementing basic security configurations such as creating a dedicated user, setting up
SSH key authentication, configuring a firewall with UFW, and hardening the system with
Fail2Ban and automatic updates. This setup provides a secure and optimized environment for
ML development.