2024年6月6日发(作者:)

Freebsd的桌面安装笔记

最近在学习freebsd,看了freebsd的handbook,里面介绍了安装freebsd桌面,于是为了提

高自己对freebsd的认识和理解,自己决定安装freebsd gnome。

看了freebsd handbook,安装gnome 步骤:

To install the GNOME package from the network, simply type:

#

pkg_add -r gnome2

To build GNOME from source, use the ports tree:

#

cd /usr/ports/x11/gnome2

#

make install clean

本来是打算自己make 源代码的,但是自己从port来编译gnome2速度太慢,而且还经常报错。没办法用

pkg来安装。Pkg安装倒是很快就能安装成功,但是重启之后不成功,按照handbook的步骤启动:

Once GNOME is installed, the X server must be told to start GNOME instead of a default window

manager. If a

custom

.xinitrc

is already in place, simply replace the line that starts the current window manager

with one that

149

Chapter 5 The X Window System

starts /usr/X11R6/bin/gnome-session instead. If nothing special has been done to configuration file,

then it is

enough to simply type:

%

echo "/usr/X11R6/bin/gnome-session" > ~/.xinitrc

Next, type

startx

, and the GNOME desktop environment will be started.

Note: If a display manager, like XDM, is being used, this will not work. Instead, create an

executable

.xsession

file with the same command in it. To do this, edit the file and replace the existing window manager

command with

/usr/X11R6/bin/gnome-session:

%

echo "#!/bin/sh" > ~/.xsession

%

echo "/usr/X11R6/bin/gnome-session" >> ~/.xsession

%

chmod +x ~/.xsession

Another option is to configure the display manager to allow choosing

但是在usr目录下根本找不到X11R6这个目录,这时候陷如僵局,折腾了好几天,重新安装了

gnome,甚至怀疑了freebsd对显卡驱动不支持,后来使用demsg查看,freebsd对显卡是support

的。

经过一段时间的摸索,在安装了xorg之后,freebsd桌面竟然起起来了。为什么安装了xorg之后,

gnome2就起来了,后来再次仔细研读了freebsd handbook,发现了

The X Client/Server Model

X was designed from the beginning to be network-centric, and adopts a “client-server” model.

In the X model, the “X server” runs on the computer that has the keyboard, monitor, and mouse

attached. Theserver’s responsibility includes tasks such as managing the display, handling input from

the keyboard and mouse, andso on. Each X application (such as XTerm, or Netscape) is a “client”. A

client sends messages to the server such as“Please draw a window at these coordinates”, and the server

sends back messages such as “The user just clicked onthe OK button”.Starting with FreeBSD

5.3-RELEASE, the X server that installs with FreeBSD is Xorg, and is available for free经过理解,

xorg就是freebsd的server 而gnome 就是client。所以安装的时候,必须要同时安装这两个程序,

freebsd才能成功。

Freebsd的桌面远程连接

可以使用gdm 远程来连接,但是连接的电脑如果通过NAT连入的,则提示失败。解决

的方法是,可以通过SSH来连接linux的桌面:

SSH server Config file Setup

OpenSSH /etc/ssh/sshd_config X11Forwarding yes

/etc/ssh2/sshd2_config AllowX11Forwarding yes

Run Xstart in the Xmanager folder.

Click New. RESULT: A New Session dialog box appears.

Enter a new session name, and click OK.

In the Host box, enter the hostname or IP address of the remote Linux/Unix host.

In the Protocol box, In the Protocol box, whatever protocol available on the remote host

can be selecteds. But select SSH protocol at this time.

To set up protocol-specific options such as port and time-out, click Setup.

In the Username box, enter the user account on the host.

Select an Authentication type from the Authentication list.

To set up Authentication-specific options such as password and public key, click Setup.

In the Execution Command box, enter a command that will be executed on the host. We are

going to run xterm, so enter one of the following:

/usr/X11R6/bin/gnome-session

远程桌面连接成功!