Setting up an Intel Mini PC Linux Box for Automation
|
What can we help you find? |
Random | ||||||||||||||||
| Home | Testing | Automation | AI | IoT | OS | RF | Data | Development | References | Tools | Wisdom | Inspiration | Investing | History | Fun | POC | Help |
The following steps were used in a POC to setup an Intel Mini PC as a Linux box to execute automation.
Mini PC Details
https://www.amazon.com/gp/product/B0BVLS7ZHP/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&th=1
Beelink S12 Pro Mini PC, Intel 12th Gen Alder Lake- N100(up to 3.4GHz), 16GB DDR4 RAM 500GB PCIe SSD, Desktop Computer Support 4K Dual Display/USB3.2/WiFi 6/BT5.2/Gigabit Ethernet for Home/Office
Product Details: https://www.bee-link.com/catalog/product/index?id=434
Model: Mini S12 Pro
Processor: Intel N100
Clock: 3.4 Ghz
Cores: 4
RAM: 16 Gigs (DDR4 3200 Mhz - Single Channel)
Storage: 500 Gigs PCIe SSD
Wifi: 6 802.11ax (600 Mbps)
Bluetooth: 5.2
Ethernet: 1 Gigabit
Size: 4.5" x 4.5" x 1.54"
Video: HDMI x2
How to make a bootable USB Drive
Ref: https://www.youtube.com/watch?v=dalAJalZYDY
F7 on boot to select Boot Drive
How do I install a Linux OS on this Mini PC?
You need to make a bootable USB Drive
How do I make a bootable USB Drive?
Find a USB Drive
- Connect the USB drive to your Mac
- Open Disk Utility
- Erase USB Drive choosing either the exFAT or FAT32 format
- Download Linux ISO
diskutil list- Locate your USB drive in the list and note its identifier (e.g., disk2).
diskutil unmountDisk /dev/diskX- Unmount the USB Drive: Replace diskX with your actual drive identifier
sudo dd if=/path/to/iso of=/dev/rdiskX bs=1m- Write the ISO to the USB Drive: Use the dd command to write the ISO file to your USB drive. Replace /path/to/iso with the path to your ISO file and diskX with your drive identifier:
- Note: Using /dev/rdiskX instead of /dev/diskX may result in faster data transfer as it uses raw mode.
diskutil eject /dev/diskX- Eject the USB Drive: After the process is complete, eject the USB drive
Which architecture supports the N100 Intel
amd64
Which Linux Distro should I install?
- Should support Chrome
- Java 21
A: Debian Bookworm and Ubuntu
- Debian 12.5 (bookworm) ISO's
- ISO to download
- User Guide
- Ubuntu 22.04.4 LTS
- Getting Started Guide
Ensure local user is in sudoers file
Switch to the root user
su - root
Enter Password
Update sudo users
sudo visudo
Look for the following.
# User privilege specification
root ALL=(ALL:ALL) ALL
Add the following below these lines
yourusername ALL=(ALL:ALL) ALL
Save changes.
Reboot
Ensure network connectivity and update all software
Launch Firefox to ensure connecting to web.
defaults write com.apple.Finder AppleShowAllFiles true
killall Finder
Ensure apt is up to date
sudo apt update
Install SSH
sudo apt-get update
sudo apt-get install openssh-server
Start the SSH Server
sudo systemctl start ssh
Enable SSH to start on boot
sudo systemctl enable ssh
On another system launch a terminal
type sss username@ipaddress
You might get a message like this
The authenticity of host 'ipaddress (ipaddress)' can't be established. ED25519 key fingerprint is SHA256:sdlaslhashdalsdnlaksdlkajsldja This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type "Yes"
If you get an error like this
Warning: Permanently added '192.168.1.242' (ED25519) to the list of known hosts. ssh_dispatch_run_fatal: Connection to 192.168.1.242 port 22: Broken pipe
Try authenticating again to the SSH server.
You should see a message like this
Linux vmdebian12masterv01 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) x86_64
Which means you've authenticated into the remote server.
Then you are done with the SSH session simply type exit
Install Synology Guest Tool
apt-get install qemu-guest-agent
Install Dask to Dock
This will ensure the dash (known as the DOck on Mac) will be displayed all the time
sudo apt install gnome-shell-extension-dashtodock -y
Reboot
After restarting, search for “Extensions” in the “Activities” overview.
In the “Extensions” tab, activate “Dash to Dock”.
Click on the gear icon left of the activation slide switch to change position.
Installing curl
sudo apt install curl
Installing git
sudo apt install git
Installing ZShell
Check the current shell echo $0
sudo apt install zsh
sudo chsh -s /usr/bin/zsh (Change to default shell)
Installing Oh-My-ZShell
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Installing Oh-My-ZShell - Plugin - Syntax Highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Add the following to the .zshrc file
plugins=(git zsh-syntax-highlighting)
Refresh the shell
source ~/.zshrc
Installing Audio Events Module
sudo apt-get install libcanberra-gtk-module
Installing netstat
sudo apt install net-tools
Setting x11 (Xorg) as your desktop environment
sudo nano /etc/gdm3/custom.conf
In the custom.conf file, look for the line that reads #WaylandEnable=false.
If the line is commented out (with a # at the beginning), uncomment it by removing the #.
This will disable Wayland and enable X11 as the default display server.
- Reboot your system
- Check x11 is now your desktop
echo $XDG_SESSION_TYPE
You should see x11
Installing RealVNC on Ubuntu 22
- Open Firefox
- Download RealVNC
- Install RealVNC
sudo dpkg -i VNC-Server-7.10.0-Linux-x64.deb
- Start and Enable RealVNC Services
sudo systemctl enable --now vncserver-virtuald.service
sudo systemctl enable --now vncserver-x11-serviced.service
- Set the VNC Password
vncpasswd -user
sudo systemctl restart vncserver-x11-serviced.service (This restarts the service)
- Verify RealVNC is up and running
systemctl status vncserver-x11-serviced.service
systemctl status vncserver-virtuald.service
- Troubleshooting
sudo systemctl status vncserver-x11-serviced.service
sudo systemctl status vncserver-virtuald.service
sudo netstat -tulpn
netstat -tulpn | grep :5999 (Check that RealVNC is listening on port 5999)
- I found if trying to connect to the machine via RealVNC viewer, if it was requesting a user ID, I had to log into RealVNC website and confirm my identity which did require an email to confirm. Once that was done I no longer had to provide a user ID.
- Working !!!
Uninstall RealVNC
- Remove the RealVNC server package
- sudo apt remove realvnc-vnc-server
- Remove any configuration files associated with RealVNC
- sudo apt purge realvnc-vnc-server
- Check for and remove any systemd service files
- sudo systemctl disable vncserver-virtuald.service
- sudo systemctl disable vncserver-x11-serviced.service
Installing Google Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
Installing Java 21
sudo apt install openjdk-21-jdk
Check installed version
java -version
Installing Java 21 (Alternate)
wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
sudo dpkg -i jdk-21_linux-x64_bin.deb
Check installed version
java -version
Installing Maven 3
sudo apt install maven
Check installed version
mvn -version
Installing Allure
wget https://github.com/allure-framework/allure2/releases/download/2.27.0/allure_2.27.0-1_all.deb
sudo apt-get update
sudo apt-get install default-jre-headless
sudo apt --fix-broken install
sudo apt-get install default-jre-headless
sudo dpkg -i ./allure_2.27.0-1_all.deb
allure --version
Installing VSCode
Install the dependencies
sudo apt install software-properties-common apt-transport-https wget
Import the Microsoft GPG key
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
Enable the Visual Studio Code repository
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
Update the package index
sudo apt update
Install Visual Studio Code
sudo apt install code
GitHub - Check if SSH key already exists
Review any existing SSH keys.
ls -al ~/.ssh
Look for any of the following filenames:
id_rsa.pub
id_ecdsa.pub
id_ed25519.pub
If you see any of these files, it means you already have an existing SSH key pair associated with GitHub.
Test the SSH connection.
ssh -T git@github.com
GitHub - Remove SSH Key
Review any existing SSH keys.
ls -al ~/.ssh
Remove GitHub SSH key
rm ~/.ssh/id_rsa
GitHub - Set up SSH Key
Generate SSH key pair.
ssh-keygen -t rsa -b 4096 -C "greg@gregpaskal.com"
Accept the default file location. (/home/username/.ssh/id_rsa)
Accept the default passphrase (empty for no passphrase) (x2)
This should generate a key fingerprint. (Looks something like the following.)
SHA256:sdhskdjfhskjdfkjsdhfkjsdfksdfkjsdhfkjshdfkshdfkshdfkjh myemail@email.com
It should also generate a key's randomart image.
+---[RSA 4096]----+
(a bunch of stuff here)
+----[SHA256]-----+
Start the ssh-agent in the background.
eval "$(ssh-agent -s)"
Add your SSH private key to it.
ssh-add ~/.ssh/id_rsa
View the contents of your public key file.
cat ~/.ssh/id_rsa.pub
Copy this content to the clipboard.
Go to GitHub
https://github.com/settings/keys
Click on New SSH key.
Provide the following details.
Title: VM Debian SSH Key
Key type: Authentication Key
Paste your key into the key field.
Click Add SSH key.
(You might have to authenticate your GitHub account.)
To test that your SSH key is working, do the following.
ssh -T git@github.com
You will likely see the following message.
This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type Yes
You should get something like this if it's working.
Hi gregpaskal! You've successfully authenticated, but GitHub does not provide shell access.
GitHub - GitHub repo
git clone git@github.com:MurahoTraining/Automation-JAV-SwagLabs.git
The repo should now be cloned.
Set JAVA_HOME variable
Find where Java is installed
echo $(dirname $(dirname $(readlink -f $(which javac))))
You're likely to see an entry like this
/usr/lib/jvm/jdk-21-oracle-x64
Check if JAVA_HOME already exist in ~/.bashrc
grep 'export JAVA_HOME' ~/.bashrc
Open ~/.bashrc and paste the following in near the other export settings
# Java Home
export JAVA_HOME="/usr/lib/jvm/jdk-21-oracle-x64"
Then run
source ~/.bashrc
Check if JAVA_HOME already exist in ~/.zshrc
grep 'export JAVA_HOME' ~/.zshrc
Open ~/.zshrc and paste the following in near the other export settings
# Java Home
export JAVA_HOME="/usr/lib/jvm/jdk-21-oracle-x64"
Then run
source ~/.zshrc
Install Jenkins
sudo apt-get update
Add the Jenkins repository key to your system
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io.key
Add the Jenkins repository to your system
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
Install Jenkins
sudo apt-get update
sudo apt-get install jenkins
Start and enable the Jenkins service
sudo systemctl start jenkins
sudo systemctl enable jenkins
Get the initial admin password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Which will look something like this
745154e83e374313ba8f6c0a23e119a1
Access Jenkins
Enter password discovered above (Remember you will need to change this)
Jenkins - Getting Started
Install suggested plugins
This will take a while and will get everything installed
Create first admin user
Username
Password
etc...
Installing Apache
sudo apt update
sudo apt install apache2
Check Apache status
sudo systemctl status apache2
You should see active (running) if Apache is running.
Test that Apache is serving HTML content
In a browser, go to http://192.168.1.youripaddress
The Apache2 Default Page should come up.
Installing MySQL
sudo apt install default-mysql-server
If asked if you want to secure your MySQL installation answer "Yes"
Check MySQL service is running
sudo systemctl status mysql
You should see active (running) if MySQL is running.
Installing PHP
sudo apt install php libapache2-mod-php php-mysql
To test PHP installation, let create a basic test page for PHP.
sudo nano /var/www/html/info.php
<?php
phpinfo();
?>
In a browser, go to http://192.168.1.youripaddress/info.php
You should now see the PHP info page come up.
Installing Wordpress
cd /tmp
Download the latest version of Wordpress
wget https://wordpress.org/latest.tar.gz
Extract WordPress to the /var/www/html/ directory
tar xzvf latest.tar.gz
Move these files to the HTMl Directory
sudo cp -a /tmp/wordpress/. /var/www/html/
Configure the MySQL Database
sudo mysql
You will now be in the MySQL Shell
database_name = Your desired database name (wordpress01)
username = Your desired username (wpdbuser)
password = Your desired password (wpdbpassword)
CREATE DATABASE database_name DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Configure WordPress by making a copy of the sample configuration.
cd /var/www/html/
sudo cp wp-config-sample.php wp-config.php
Modify the configuration file
sudo nano wp-config.php
replace 'database_name_here', 'username_here', and 'password_here' with your database name, username, and password. then save changes and exit nano.
Set Permissions
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
Remove index.html file if necessary
sudo rm /var/www/html/index.html
Run the Wordpress installation from your Web browser
In a browser, go to http://192.168.1.youripaddress
Configure your new WordPress installation
How do I copy and paste between Mac and a VM running Debian Linux
Open Virtual Machine Manager
Select a virtual machine
Select Action -> Edit
Select Other
Set Additional ISO File to Synology_VMM_Guest_Tool
Click OK button
Power on the VM
Click "Connect"