在 Ubuntu 中安装 Guacamole 以进行远程 Linux/Windows 访问
在当今互联的世界中,远程访问 Linux 和 Windows 计算机对于高效的系统管理和故障排除至关重要。 Guacamole 是一种开源无客户端远程桌面网关,允许您仅使用 Web 浏览器从任何地方访问您的计算机。在本文中,我们将指导您完成在 Ubuntu 上安装 Guacamole 的过程,并演示如何远程访问 Linux 和 Windows 系统。
先决条件
在我们开始之前,请确保您具备以下先决条件 -
运行具有管理权限的 Ubuntu(版本 18.04 或更高版本)的计算机。
稳定的互联网连接。
让我们开始吧!
第1步:更新系统包
首先,让我们通过运行以下命令来更新 Ubuntu 计算机上的系统软件包 -
sudo apt update
sudo apt upgrade -y
这些命令将更新您的软件包列表并升级系统上任何过时的软件包。
第2步:安装依赖项
鳄梨酱需要几个依赖项才能正常运行。运行以下命令来安装它们 -
sudo apt install -y libcairo2 libjpeg-turbo8 libjpeg-turbo8-dev libpng-dev libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev tomcat9 tomcat9-admin tomcat9-common tomcat9-user
此命令将安装鳄梨酱正常运行所需的库和工具。
第 3 步:下载并安装鳄梨酱服务器
现在,让我们按照以下步骤下载并安装鳄梨酱服务器组件 -
示例
使用 wget 下载鳄梨酱服务器源代码存档 -
wget https://downloads.apache.org/guacamole/1.3.0/source/guacamole-server-1.3.0.tar.gz
输出
--2023-06-29 12:00:00-- https://downloads.apache.org/guacamole/1.3.0/source/guacamole-server-1.3.0.tar.gz
Resolving downloads.apache.org (downloads.apache.org)... 207.244.88.140, 40.79.78.1, 88.99.95.219, ...
Connecting to downloads.apache.org (downloads.apache.org)|207.244.88.140|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2483457 (2.4M) [application/x-gzip]
Saving to: ‘guacamole-server-1.3.0.tar.gz’
guacamole-server-1.3.0.tar.gz 100%[====================================================================>] 2.37M --.-KB/s in 0.1s
2023-06-29 12:00:00 (23.4 MB/s) - ‘guacamole-server-1.3.0.tar.gz’ saved [2483457/2483457]
解压下载的存档 -
示例
tar -xzf guacamole-server-1.3.0.tar.gz
输出
guacamole-server-1.3.0/
guacamole-server-1.3.0/src/
guacamole-server-1.3.0/src/modules/
guacamole-server-1.3.0/src/modules/rdp/
guacamole-server-1.3.0/src/modules/rdp/README
guacamole-server-1.3.0/src/modules/rdp/rdp_settings.c
guacamole-server-1.3.0/src/modules/rdp/rdp_cache.c
guacamole-server-1.3.0/src/modules/rdp/rdp_fs.c
guacamole-server-1.3.0/src/modules/rdp/rdp_cliprdr.c
guacamole-server-1.3.0/src/modules/rdp/rdpdr_messages.c
guacamole-server-1.3.0/src/modules/rdp/rdpdr_fs_messages.c
guacamole-server-1.3.0/src/modules/rdp/rdp_svc.c
guacamole-server-1.3.0/src/modules/rdp/rdpdr_messages.h
...
更改为提取的目录 -
示例
cd guacamole-server-1.3.0
配置构建 -
./configure --with-init-dir=/etc/init.d
输出
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
...
构建并安装鳄梨酱服务器 -
示例
make
sudo make install
sudo ldconfig
输出
...
make[1]: Entering directory '/path/to/package'
make[2]: Entering directory '/path/to/package/src'
/bin/mkdir -p '/usr/local/bin'
/bin/mkdir -p '/usr/local/lib'
/usr/bin/install -c program_name '/usr/local/bin'
/usr/bin/install -c -m 644 libname.so '/usr/local/lib'
/usr/bin/install -c -m 644 header.h '/usr/local/include'
make[2]: Leaving directory '/path/to/package/src'
make[1]: Leaving directory '/path/to/package'
第 4 步:配置鳄梨酱
安装服务器后,就可以配置 Guacamole 了。你可以这样做 -
复制示例鳄梨酱配置文件 -
sudo cp guacamole-server-1.3.0/guacamole-server/src/main/webapp/WEB-INF/guacamole.properties.example /etc/guacamole/guacamole.properties
使用您选择的文本编辑器编辑配置文件。例如 -
sudo nano /etc/guacamole/guacamole.properties
在此文件中,您可以自定义各种设置,例如数据库连接详细信息、身份验证机制等。编辑文件后请务必保存更改。
第 5 步:部署鳄梨酱 Web 应用程序
要在 Ubuntu 计算机上部署 Guacamole Web 应用程序,请按照以下步骤操作 -
下载鳄梨酱 Web 应用程序存档 -
wget https://downloads.apache.org/guacamole/1.3.0/binary/guacamole-1.3.0.war -O guacamole.war
将下载的存档移至 Tomcat webapps 目录 -
sudo mv guacamole.war /var/lib/tomcat9/webapps/guacamole.war
重新启动 Tomcat 以使更改生效 -
sudo systemctl restart tomcat9
第 6 步:访问鳄梨酱 Web 界面
至此,鳄梨酱已安装并可供使用。要访问鳄梨酱 Web 界面,请打开 Web 浏览器并输入以下 URL -
http://<your-server-ip>:8080/guacamole/
将
步骤 7:配置鳄梨酱用户和连接
要开始使用鳄梨酱,您需要配置用户和连接。你可以这样做 -
打开鳄梨酱配置文件 -
sudo nano /etc/guacamole/guacamole.properties
取消注释 # auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider 行并保存文件。
创建一个新文件用于用户身份验证 -
sudo nano /etc/guacamole/user-mapping.xml
将用户和连接配置添加到 user-mapping.xml 文件。这是 Linux 机器的示例配置 -
<?xml version="1.0" encoding="UTF-8"?>
<user-mapping>
<authorize username="user1" password="password1">
<connection name="Linux Server">
<protocol>ssh</protocol>
<param name="hostname">192.168.1.100</param>
<param name="port">22</param>
<param name="username">remoteuser</param>
</connection>
</authorize>
</user-mapping>
在此示例中,名为“user1”、密码为“password1”的用户配置为通过 SSH 连接到 Linux 服务器。
保存 user-mapping.xml 文件。
重新启动 Tomcat 以应用配置更改 -
sudo systemctl restart tomcat9
结论
恭喜!您已在 Guacamole 中成功配置用户和连接,允许您轻松访问远程 Linux 和 Windows 计算机。鳄梨酱提供了一种通过网络浏览器远程管理系统的便捷且安全的方法。
请记住定期更新和维护您的鳄梨酱安装,以便从最新功能和安全补丁中受益。
享受鳄梨酱远程访问的便利!