Cài đặt Apache Guacamole sử dụng Docker Compose
1. Tải mã nguồn
Kết nối vào máy ảo Ubuntu / Debian của bạn và tải mã nguồn về máy:
cd ~ git clone "https://github.com/boschkundendienst/guacamole-docker-compose.git"
Nếu bị báo lỗi git: command not found
, bạn cần cài đặt thêm git bằng lệnh dưới đây, sau đó thực hiện lại:
sudo apt install git
2. Chuẩn bị hệ thống
Truy cập vào thư mục guacamole-docker-compose
và chạy script prepare.sh
để hệ thống khởi tạo các file cấu hình cần thiết:
cd guacamole-docker-compose
./prepare.sh
Kết quả hiện ra sau 1-2 giây:
Preparing folder init and creating ./init/initdb.sql
done
Creating SSL certificates
Generating a RSA private key
.........+++++
..................+++++
writing new private key to 'nginx/ssl/self-ssl.key'
-----
You can use your own certificates by placing the private key in nginx/ssl/self-ssl.key and the cert in nginx/ssl/self.cert
done
3. Chỉnh sửa docker-compose.yml
Tổng cộng sẽ có 4 dịch vụ được kích hoạt, mỗi dịch vụ đảm nhận một nhiệm vụ:
- guacd: Guacamole Server
- guacamole: Guacamole Client
- postgres: PostgresSQL Database
- Nginx: Reverse Proxy (không bắt buộc)
Nếu bạn đã có sẵn Nginx Proxy Manager làm Reverse Proxy, bạn có thể bỏ qua phần Nginx. Hãy sửa file docker-compose.yml
như sau:
version: '2.0' networks: guacnetwork_compose: driver: bridge services: guacd: container_name: guacd_compose image: guacamole/guacd networks: guacnetwork_compose: restart: always volumes: - ./drive:/drive:rw - ./record:/record:rw postgres: container_name: postgres_guacamole_compose environment: PGDATA: /var/lib/postgresql/data/guacamole POSTGRES_DB: guacamole_db POSTGRES_PASSWORD: 'ChooseYourOwnPasswordHere1234' POSTGRES_USER: guacamole_user image: postgres:13.4 networks: guacnetwork_compose: restart: always volumes: - ./init:/docker-entrypoint-initdb.d:ro - ./data:/var/lib/postgresql/data:rw guacamole: container_name: guacamole_compose depends_on: - guacd - postgres environment: GUACD_HOSTNAME: guacd POSTGRES_DATABASE: guacamole_db POSTGRES_HOSTNAME: postgres POSTGRES_PASSWORD: 'ChooseYourOwnPasswordHere1234' POSTGRES_USER: guacamole_user image: guacamole/guacamole links: - guacd networks: guacnetwork_compose: ports: - 8080:8080/tcp # Guacamole is on :8080/guacamole, not /. restart: always
4. Kích hoạt Guacamole
Chạy lệnh sau để kích hoạt dịch vụ:
docker-compose up -d
Sau đó, mở trình duyệt và truy cập vào địa chỉ:
http://<IP-của-Server>:8080/guacamole
Sau khi truy cập thành công, bạn sẽ nhìn thấy trang đăng nhập Guacamole như dưới đây:
- Username: guacadmin
- Password: guacadmin
Lưu ý: Hãy thay đổi mật khẩu ngay sau khi đăng nhập lần đầu.