Try   HackMD

Hướng dẫn cài đặt server Ubuntu 20.4

Cài đặt Apache 2.4

  • Chạy lệnh để update các repository
sudo apt-get -y update
  • Tiến hành cài đặt apache 2.4
sudo apt install apache2
  • Khởi động apache service
sudo service apache2 restart
  • Truy cập test thử website bằng đường dẫn http://your_server_ip

Cài đặt mariadb (Mysql)

  • Chạy lệnh để cài mariaDB
sudo apt install mariadb-server
  • Cài đặt mật khẩu cho tài khoản root
sudo mysql_secure_installation
  • Đối với lần đầu mật khẩu root mặc định là trống ở phần câu hỏi Enter current password for root (enter for none): bấm enter để xác nhận
  • Set root password? [Y/n]: Chọn Y.
  • Nhập 2 lần mật khẩu để khởi tạo mật khẩu root cho mysql
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Cài đặt PHP và các extension cần thiết để chạy laravel

  • Thêm repository
sudo add-apt-repository ppa:ondrej/php
  • Chạy lệnh để update các repository
sudo apt-get -y update
  • Lệnh cài PHP 7.4:
sudo apt-get install -y php7.4 libapache2-mod-php7.4 php7.4 php7.4-common php7.4-gd php7.4-mysql php7.4-curl php7.4-gd php7.4-intl php7.4-xsl php7.4-mbstring php7.4-zip php7.4-bcmath

Thao tác thêm

  • Mở mod rewrite để htaccess hoạt động
sudo a2enmod rewrite
  • Sao khi mở mod của apache phải khởi động lại service
sudo service apache2 restart
  • Trường hợp code PHP không được thực thi (hiển thị ra toàn bộ thông tin code) : Chạy lệnh để mở mod PHP cho apache2
sudo  a2enmod php7.4

Nguồn tham khảo:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04
https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-ubuntu-20-04