|
@@ -1,4 +1,4 @@
|
|
|
-# Setup Instructions for Ubuntu
|
|
|
+# Ubuntu System Setup Guide
|
|
|
|
|
|
This guide will help you set up a basic development environment on Ubuntu with the following tools:
|
|
|
- Update and upgrade the system
|
|
@@ -6,6 +6,9 @@ This guide will help you set up a basic development environment on Ubuntu with t
|
|
|
- Install **Node.js 20**
|
|
|
- Install **Git**
|
|
|
- Install **NGINX**
|
|
|
+- Install **mysql-server**
|
|
|
+- Install **phpmyadmin**
|
|
|
+- Install **php** latest version with php-fpm
|
|
|
|
|
|
## Prerequisites
|
|
|
- Ubuntu (any version)
|
|
@@ -93,3 +96,124 @@ sudo apt install nginx -y
|
|
|
sudo systemctl start nginx
|
|
|
sudo systemctl enable nginx
|
|
|
```
|
|
|
+
|
|
|
+
|
|
|
+## 5.Install MySQL Server
|
|
|
+```bash
|
|
|
+sudo apt install mysql-server -y
|
|
|
+```
|
|
|
+Secure the MySQL installation:
|
|
|
+```bash
|
|
|
+sudo mysql_secure_installation
|
|
|
+```
|
|
|
+Follow the prompts to set a root password and secure the database.
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+## 6. Install PHP 8.3 or Latest Version
|
|
|
+Add the repository and install PHP:
|
|
|
+```bash
|
|
|
+sudo add-apt-repository ppa:ondrej/php -y
|
|
|
+sudo apt update
|
|
|
+sudo apt install php8.3 php8.3-fpm php8.3-cli php8.3-mysql php8.3-curl php8.3-xml php8.3-mbstring php8.3-zip php8.3-bcmath php8.3-gd php8.3-intl php8.3-readline -y
|
|
|
+```
|
|
|
+Restart PHP-FPM:
|
|
|
+```bash
|
|
|
+sudo systemctl restart php8.3-fpm
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 7. Install phpMyAdmin
|
|
|
+```bash
|
|
|
+sudo apt install phpmyadmin -y
|
|
|
+```
|
|
|
+During the installation, select **NGINX** and configure the database for phpMyAdmin.
|
|
|
+
|
|
|
+Create a symbolic link for phpMyAdmin in the NGINX web directory:
|
|
|
+```bash
|
|
|
+sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
|
|
|
+```
|
|
|
+Restart NGINX:
|
|
|
+```bash
|
|
|
+sudo systemctl restart nginx
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 8. Create a User for phpMyAdmin and Grant Privileges
|
|
|
+Log in to MySQL:
|
|
|
+```bash
|
|
|
+sudo mysql -u root -p
|
|
|
+```
|
|
|
+Create a new user:
|
|
|
+```sql
|
|
|
+CREATE USER 'phpmyadmin_user'@'localhost' IDENTIFIED BY 'secure_password';
|
|
|
+```
|
|
|
+Grant privileges:
|
|
|
+```sql
|
|
|
+GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin_user'@'localhost' WITH GRANT OPTION;
|
|
|
+FLUSH PRIVILEGES;
|
|
|
+EXIT;
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 9. Configure Firewall (UFW)
|
|
|
+Allow necessary ports:
|
|
|
+```bash
|
|
|
+sudo ufw allow 22/tcp # SSH
|
|
|
+sudo ufw allow 80/tcp # HTTP
|
|
|
+sudo ufw allow 443/tcp # HTTPS
|
|
|
+sudo ufw enable
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 10. Install and Configure Code Server
|
|
|
+### **Step 1: Install Code Server**
|
|
|
+```bash
|
|
|
+curl -fsSL https://code-server.dev/install.sh | sh
|
|
|
+```
|
|
|
+### **Step 2: Configure Code Server for the Current User**
|
|
|
+```bash
|
|
|
+mkdir -p ~/.config/code-server
|
|
|
+nano ~/.config/code-server/config.yaml
|
|
|
+```
|
|
|
+Add the following configuration:
|
|
|
+```yaml
|
|
|
+bind-addr: 127.0.0.1:8080
|
|
|
+auth: password
|
|
|
+password: "your_secure_password"
|
|
|
+cert: false
|
|
|
+```
|
|
|
+Save and exit (`CTRL+X`, `Y`, `ENTER`).
|
|
|
+
|
|
|
+Start Code Server:
|
|
|
+```bash
|
|
|
+code-server
|
|
|
+```
|
|
|
+
|
|
|
+To run it as a service:
|
|
|
+```bash
|
|
|
+sudo systemctl enable --now code-server@$USER
|
|
|
+```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 11. Install Certbot and Secure Domain with Let's Encrypt
|
|
|
+```bash
|
|
|
+sudo apt install certbot python3-certbot-nginx -y
|
|
|
+```
|
|
|
+Obtain an SSL certificate:
|
|
|
+```bash
|
|
|
+sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
|
|
|
+```
|
|
|
+Verify auto-renewal:
|
|
|
+```bash
|
|
|
+sudo certbot renew --dry-run
|
|
|
+```
|
|
|
+
|
|
|
+---
|