Menginstall paket untuk lingkungan pengenbangan web di Linux sangatlah mudah, kita bisa menggunakan paketan yang telah ada seperti LAMP atau dapat pula menginstall one-by-one paket-paket server dan modul untuk pengembangan web agar lebih efisien. Jika di Windows kita memakai XAMPP yang berisikan web server Apache, kemudian database server MySQL, modul bahasa scripting PHP5, FTP Server dan kawan-kawannya, maka di Linux juga ada versinya yang bernama LAMP.
Lamp berisikan paket-paket software seperti yang saya sebutkan diatas, namun jika langsung menggunakan LAMP (sudo apt-get install LAMP) biasanya paket-paket yang dibundle agak kurang up to date, jadi saya lebih menyarankan untuk menginstal satu persatu paket-paket yang akan kita gunakan untuk membangun web dinamis:
Pertama sebelum menginstall, pastikan daftar software kita uptodate, update dengan cara :
$sudo apt-get update
$sudo apt-get upgrade -y
Apache2 dapat diinstall dengan menjalankan perintah:
$ sudo apt-get install apache2 libapache2-mod-php5
Untuk konfigurasi seperti virtualhost, terletak pada direktori /etc/apache2/site-available, jika kalian ingin membuat virtualhost, tinggal di copy saja file konfigurasi default pada direktori tersebut kemudian beri nama sesuai situs, lakukan penyetingan server name dan directory root (sama seperti di Windows) kemudian enable site tersebut dan reload atau restart service apache2 dengan perintah
$ sudo a2ensite namasitus
$ sudo service apache2 restart
Untuk direktori webroot terletak di /var/www sama seperti Linux pada umumnya, jika di Windows biasanya di C:\XAMPP\htdoc
Modul PHP5 dapat diinstall dengan perintah:
$ sudo apt-get install php5 php5-mysql php-imagick
Untuk melihat daftar paket lengkap, gunakan perintah:
$ sudo apt-cache search php
maka akan muncul semua paket PHP yang mungkin kalian butuhkan.
Cara menginstall MySQL di Raspberry juga sangat mudah, versi server dan client dapat diinstall dengan perintah berikut:
$ sudo apt-get install mysql-server mysql-client
Seperti XAMPP, kita biasanya bisa dengan mudah memanipulasi database melalui antarmuka web menggunakan PHPMyAdmin, begitupula di Linux dan Raspberry Pi PHPMyAdmin sudah pasti tersedia, caranya install:
$ sudo apt-get install phpmyadmin
Lakukan sedikit konfigurasi khususnya akun database ketika installasi, setelah selesai dapat diakses melaluihttp://127.0.0.1/phpmyadmin atau ganti IP lokalhost dengan IP Raspberry Pi di jaringan.
Ubuntu#
Ubuntu is a Debian-based Linux operating system. It provides a user-friendly graphical interface (although we'll mainly work with the command line for this installation) and a large repository of software packages. The stability and security features of Ubuntu make it a great choice for running Home Assistant as a long-term home automation solution.
Prerequisites#
Ubuntu Installation: You need to have Ubuntu installed on your machine. It can be a physical machine or a virtual machine. The recommended version is Ubuntu 20.04 or later.
Hardware Requirements: A machine with at least 2GB of RAM and 10GB of free disk space is recommended for a smooth experience.
Internet Connection: You need a stable internet connection to download the necessary packages and update Home Assistant.
Installation Steps#
Step 1: Update the System#
Open the terminal and run the following commands to update the package lists and upgrade the installed packages:
sudo apt update
sudo apt upgrade -y
Step 2: Install Dependencies#
Home Assistant requires several dependencies to run. Install them using the following command:
sudo apt install -y software-properties-common apparmor-utils apt-transport-https ca-certificates curl dbus jq network-manager
Step 3: Add the Home Assistant Repository#
Add the Home Assistant repository to your system's package sources:
curl -fsSL https://repo.home-assistant.io/addons/repository.gpg | sudo gpg --dearmor -o /usr/share/keyrings/homeassistant-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/homeassistant-archive-keyring.gpg] https://repo.home-assistant.io/addons/debian stable main" | sudo tee /etc/apt/sources.list.d/homeassistant.list
Step 4: Update Package Lists Again#
After adding the repository, update the package lists:
sudo apt update
Step 5: Install Home Assistant#
Install the Home Assistant Supervised package:
sudo apt install homeassistant-supervised
Step 6: Start Home Assistant#
After the installation is complete, start the Home Assistant service:
sudo systemctl start [email protected]
You can also enable the service to start automatically on boot:
sudo systemctl enable [email protected]
Usage Methods#
Accessing the Web Interface#
Once Home Assistant is running, you can access the web interface by opening a web browser and navigating to http://<your - server - ip>:8123. Replace <your - server - ip> with the actual IP address of your Ubuntu machine.
Adding Integrations#
To add integrations, click on the "Configuration" tab in the Home Assistant web interface, then select "Integrations". Click on the "+ Add Integration" button and search for the device or service you want to integrate. Follow the on-screen instructions to complete the setup.
Creating Automations#
To create an automation, click on the "Automations" tab in the Home Assistant web interface. Click on the "+ Add Automation" button. You can define triggers (such as a motion sensor being activated), conditions (such as the time of day), and actions (such as turning on a light).
Common Practices#
Regular Backups#
Regularly back up your Home Assistant configuration. You can do this through the Home Assistant web interface by going to "Configuration" > "Backups". Create a full backup at least once a week, especially before making significant changes to your configuration.
Keeping Software Up-to - Date#
Keep both Ubuntu and Home Assistant up-to-date. In Ubuntu, you can use the apt update and apt upgrade commands regularly. In Home Assistant, go to the "Supervisor" tab in the web interface and click on the "Check for updates" button.