HOWTO: Install X Window System and a Desktop Environment

Share your own howto's etc. Not for support questions!

HOWTO: Install X Window System and a Desktop Environment

Postby Scotti » 2007-02-13 02:13

So, you have just installed Debian GNU/Linux. Good for you! But, what now? All you have is a black screen in front of you with no mouse pointer or application menu or anything! What gives?!

What you need now is to install a Desktop Environment. Don't fret, it's actually pretty easy.

1. Install The X Window System

First, install the base X Window System GUI environment by issuing this command as root:
Code: Select all
# apt-get install xorg


There are a few questions you will be asked after the installation. Accepting the default choices should be fine.

2. Install a Desktop Environment

Next you will need to install a Desktop Environment. The two most popular are Gnome and KDE. You can install one or both to try them out.

To install a Desktop Environment, issue the following command as root:
Code: Select all
# apt-get install gnome

Or replace 'gnome' with 'kde' for KDE.

3. Run your Desktop Environment

After you have a Desktop Environment installed you can test everything by logging in as your non-root user and issue the command:
Code: Select all
$ startx

This should bring up your new GUI environment. Now you're ready to start using your new Debian GNU/Linux computer!

Notes:

If you would like a nice GUI environment to login with, you have the choice of installing GDM, KDM, or XDM. GDM seems to be the most popular, but you are more than welcome to try out any of the others:
Code: Select all
# apt-get install gdm

--

If you think you messed up on the configuration of the X Window System, you can run this command as root to reconfigure the package:

If you run Sarge:
Code: Select all
# dpkg-reconfigure xserver-xfree86

If you run Etch or Sid:
Code: Select all
# dpkg-reconfigure xserver-xorg

--

If you would like a minimal installation of either Desktop Environment, use the package names 'gnome-core' or 'kdebase' for Gnome or KDE, respectively.

--

There are other options from Gnome and KDE for your GUI environment. Please view XWinMan.org for a listing of other Desktop Environments and/or Window Managers.
Last edited by Scotti on 2007-04-15 19:49, edited 5 times in total.
Scotti
Moderator Team Member
 
Posts: 312
Joined: 2005-11-08 01:13

Re: HOWTO: Install X Windows and a Desktop Environment

Postby chealer » 2007-02-13 03:06

Scotti wrote:1. Install X Windows

It's "the X Window System", X11, or just X, not "X Windows".
chealer
 
Posts: 671
Joined: 2005-09-24 16:11
Location: Kebekia, Kanada

Re: HOWTO: Install X Windows and a Desktop Environment

Postby Scotti » 2007-02-13 03:48

chealer wrote:
Scotti wrote:1. Install X Windows

It's "the X Window System", X11, or just X, not "X Windows".


True enough. Thanks for the tip.
Scotti
Moderator Team Member
 
Posts: 312
Joined: 2005-11-08 01:13

Postby chealer » 2007-02-13 07:29

Thanks. Note that we already have a document dealing with KDE in more detail (except for skipping step 3) at http://wiki.debian.org/KdeDebInstall
chealer
 
Posts: 671
Joined: 2005-09-24 16:11
Location: Kebekia, Kanada

Postby garrincha » 2007-02-13 15:26

Edit (23.07.2008) - See Addendum under X-Window System
============
WWW resource:
Debian X Window System FAQ:
http://soc.if.usp.br/doc/xfree86-common/FAQ.xhtml

O'Reilley Open Book on-line: Learning Debian GNU/Linux By Bill McCarty, Chp 6. Using the X Window System:
http://www.oreilly.com/catalog/debian/c ... 06_01.html
===========================================

Something that I have kept in my documentation section with some edited updates:

This is a generalised documentation on the X-Window System installed in your Debian distribution and is aimed toward mainly those who are just getting around the Debian installed X-Window System from the non-graphical command line style, or from a login manager, XDM and for those who tired of 'googling' for info. So if you like to start your X window manager or desktop by typing 'startx' (or via XDM) there are a few things to make it easier for you. This will be mainly about (1)making your window manager or desktop environment the default system on login, and (2) running multiple X sessions.

Some background on X-Window System, window manager & desktop environment:

X-Window System:
================
In Linux, almost everything is text-based as opposed to graphical-user-interfaces (GUIs) for example in MS Windows. There are several advantages of running a text-based system in Linux, for example if you run a server it save PC resources that would otherwise be wasted running a GUI system, or if you run a really old and/or slow PC like I, a GUI-based system hog resources. In a reasonably fast and modern PC, this wouldn't be a factor and you can run all the GUIs you want without breaking sweat. So, it is down to mostly individual and organisational preference.

In Linux (and also UNIX, FreeBSD etc) the GUI runs on the top of the text-based system, the GUI is call the X-Window System or X. If you don't know it already, X-Window System in Linux takes care of things like the hardware settings such as the monitor (refresh rate & resolution), keyboard, and mouse, so the graphical application just "communicate" with the X-Window System and tell it want it want to do.

In the current stable version of Debian, Sarge 3.1, the X Window System, is called XFree86, while in the soon to be stable version of Debian, Etch 4.0, the X Window System, is called X.org. The X.org is a fork of XFree86 and the latter will probably be discontinued in term of supports.

Addendum:
========
Reference: X-Power Tools -Chris Tyler:
The xorg.conf Configuration File:
The xorg.conf configuration file is divided into five basic sections (and there are eight optional sections; see Section 3.6). Knowing the purpose of each of these sections is the key to understanding the xorg.conf file.

ServerLayout:
Defines how the screens and input devices are combined to form a display configuration.

Screen:
Combines one video card (or Device in xorg.conf terminology) and one Monitor to form a screen. This section also defines the color depth and resolution(s) to be used on that screen.

Monitor:
Describes the characteristics of the monitor - whether it supports DPMS and what scan rates are permissible.

Device:
Configures the video card.

InputDevice:
Contains configuration information for an input device. There are usually at least two of these sections—one for a pointing device and one for a keyboard.

Each Screen section brings together a Monitor and Device section, and each ServerLayout section brings together one or more Screen sections with two or more InputDevice sections.

Multiple ServerLayout sections are used to handle alternate configurations—forexample, a laptop configuration file could have one server layout for use on the road and a different server layout for use at the office.
Image





Window managers:
===============
When you have the X-Window System installed and configured in your PC, start it up by typing 'startx' from the command line, you will be greeted by a grey screen with a small box with black background. It is a bit ugly and boring. The small box is the xterm terminal. The X.org (or XFree86) has a 'focus-follow-mouse' behaviour, i.e., wherever your mouse cursor points, that is where your keyboard input goes.

If your X.org or XFree86 failed to start, check the output errors. If you received one of the most common error messages like this no screens found, it is most likely to be incorrectly configured video card or monitor settings. Run this command as root (su or sudo):
Either in Etch:
Code: Select all
dpkg-reconfigure xserver-xorg

or in Sarge:
Code: Select all
dpkg-reconfigure xserver-xfree86


walk through the configurations and answer each question correctly and if in doubt leave the setting alone. If you still receive the error, instead of autodetection try manually select the VESA driver. If this failed to work, post your problem on this message board on the appropriate trend to get expert help.

It is all very well having X-Window System, however you need a software that takes care of handling the windows, this is where the window manager comes in. The latter controls how your desktop look and act, the decorations, moving, hiding, resizing, and closing etc. There are huge numbers of window managers available today for Debian. Many of them provided things like menus, application launchers, virtual desktops, GUIs and so on, and they are all highly configurable and flexible.

Desktop environments:
====================
While the window manager provides almost everything that you need, sometimes you might want to have the "full monty" and go for a desktop environment instead. The latter will give you literally everything that you would like to have on a PC. This is most likely what you'll started out with. The most popular desktop environments in Linux world are KDE, and Gnome. However, these two need a window manager as well. KDE has its own window manager while Gnome doesn't.

For full detail see guide to window managers and desktop environments for X: http://xwinman.org/

=========================================
Making your window manager or desktop the default:
=========================================

If you have more than one window managers/desktop, you should be able to switch between them easily and also to make a window manager/desktop the default at login. If you have a graphical login manager like KDM or GDM, this is easy to do; however if you use XDM or start from the command line by running 'startx', there's a way to do so:

You need to edit either the ~/.xinitrc or ~/.xsession file that is located in your home directory. If you start your window manager/desktop from command line with 'startx', you need to edit the ~/.xinitrc
file otherwise if you use XDM, you need to edit the ~/.xsession file.

1. For ~/.xinitrc file: Open the ~/.xinitrc file with your favourite text editor, e.g. by typing
Code: Select all
$ nano ~/.xinitrc

If you do not have ~/.xinitrc in your directory you need to create one using the same command as above.
If you already have a ~/.xinitrc file, it will have a lot of text file, make a backup, e.g. by typing
Code: Select all
$ mv ~/.xinitrc ~/.xinitrc-backup


2. Add a line like this to your file:
#!/bin/sh
exec yourwindowmanager/desktop

where yourwindowmanager/desktop is the command that starts the window manager or desktop you want to be your default. As an example, mine is

#!/bin/sh
exec fluxbox

You can use "exec /usr/bin/fluxbox", as it will call to the default path /usr/bin unless you installed the fluxbox executable elsewhere. After editing the ~/.xinitrc file, save and exit from the editor. In the command line you simply type "startx" and your default window manager will start.

3. For ~/.xsession file: You need to edit this file if you have a graphical login like XDM. The latter display manager is not configurable like the KDM or GDM, so you will have to edit the ~/.xsession file manually in the same way as the ~/.xinitrc file. The ~/.xsession file as with ~/.xinitrc is also located in your home directory, so open your favourite text editor and edit it in the same
way as ~/.xinitrc in step 2 above. If you do not have a ~/.xsession file, then create one. Save and exit from the text editor, either restart or reboot and your default window manager or desltop will starts up
the next time you log in via XDM.

Some commands for starting window manager or desktop:
Gnome: gnome-session
KDE: startkde
Xfce4+: startxfce4
Enlightenment E16: enlightenment
Enlightenment DR17: enlightenment_start
FVWM: fvwm
FVWM2: fvwm2
Window Maker: wmaker
IceWM: icewm

====================
Running Multiple X-sessions
====================
1. You can run two or more X-Window System sessions simultaneously and on different virtual terminals..

The first X session that you start runs on screen 0 by default, however, you can run a second X session on screen 1, a third on screen 2, a fourth on screen 4, etc. To run a second X session on screen 1, type (if you're using command line to login to your X session):
Code: Select all
startx -- :1


To run X session on screen 2,
Code: Select all
startx -- :2


etc.

2. You can switch between X sessions. On a default Linux configuration, you have command line sessions running on your first six virtual terminals. Your first X session is running on the seventh virtual terminal (screen 0). If you're running only one X session, all the terminals after terminal seven are empty. The virtual terminals config (gettys) is located in your /etc/inittab file, e.g. mine is:
Code: Select all
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
# 4:23:respawn:/sbin/getty 38400 tty4
# 5:23:respawn:/sbin/getty 38400 tty5
# 6:23:respawn:/sbin/getty 38400 tty6


Note: Because I don't really need all of these virtual terminals and they tend to take up memory, so I made a backup of this file and disabled the three virtual terminals by commenting out getty 6, 5 and 4.

So in my case, the second X session runs in virtual terminal eight, the third session in virtual terminal nine, and so on. You can switch between X screens the same way you switch between virtual terminals by pressing the keys Ctrl+Alt and the F key with the desired terminal's number.

So to switch from screen 0 to screen 1, i.e., from the first X session to the second X session, you need to press the keys "Ctrl+Alt+F8", to go back to the first X session, you press the keys, "Ctrl+Alt+F7".

In X window system, the default screen is 0 so some applications may not work well when using other screens. For example if you type an application like "gimp" at the command line, it will run in screen 0 even though you're doing so from another screen. In order to run on the screen that you launch the applications from you need to specify a command line option, so for example to run Gimp on screen 2:
Code: Select all
gimp --display :2

You can actually launch the application from any X session or virtual terminal you want and send it to any X screen. You could actually switch between different window managers, resolution etc, for example, you can run an X session with different color depth than the default one:
Code: Select all
startx -- :1 -depth 8

This will allow you to run a second X session with a 8 bpp colour depth.
Last edited by garrincha on 2008-07-23 14:47, edited 6 times in total.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."
User avatar
garrincha
 
Posts: 2341
Joined: 2006-06-02 16:38

Postby Scotti » 2007-02-13 17:33

Lots of great info there, garrincha. Thanks for adding it.

When I wrote this I kept the new Linux user in mind. That's why my post is fairly short, but simple and to the point. I didn't want to overload and/or discourage a new user with tons of text. ;)

This also seems to be a fairly popular question/task on these forums. When I scanned the How-to section, I didn't find a thread for it. Therefor, I felt the need to write.

Adding more detailed info to this thread like garrincha has done is great and is encouraged. :)
Scotti
Moderator Team Member
 
Posts: 312
Joined: 2005-11-08 01:13

Postby frenchninja » 2007-02-15 13:45

Thanks Scotti for writing this. Lately it seems that every second or third post on this forum is 'I got a black screen and no GUI'. Hopefully with a search, folk can get onto this guide first and save themselves some time.
User avatar
frenchninja
 
Posts: 193
Joined: 2006-12-30 12:17

Postby synux » 2007-02-15 20:22

This should be sticky.. :)
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby The Seeker » 2007-02-16 15:55

synux wrote:This should be sticky.. :)

I agree, very good advice for new users.
User avatar
The Seeker
 
Posts: 30
Joined: 2007-01-17 18:36
Location: Buxton, UK

Postby dinesh » 2007-02-18 17:47

i m new to linux/debian. great tip for me . thanks a lot
dinesh
 
Posts: 74
Joined: 2007-02-18 17:30
Location: India

.xinitrc

Postby Lou » 2007-02-19 18:03

In my case, i create .xinitrc:

$ jpico .xinitrc

and then add:

#!/bin/sh

numlockx &
unclutter &
fluxbox

or any other app i want to start as i enter the X system, ('exec' is not necessay for the wm to start) and that's it, save/exit from my favorite editor and then back at the prompt:

$ startx <Enter>
Wheezy - Ratpoison - vimperator - no DM
KISS - Keep It Simple, Stupid
Lou
 
Posts: 1767
Joined: 2006-05-08 02:15
Location: Panama

Re: HOWTO: Install X Window System and a Desktop Environment

Postby aim » 2007-02-21 12:43

Scotti wrote:2. Install a Desktop Environment
Code: Select all
# apt-get install gnome



don't you think it's not so good to install full bloated gnome? why not install tiny gnome-core (or kde-core) and add software on-demand (for example iceweasel, iceweasel-gnome-support and etc.?
User avatar
aim
 
Posts: 12
Joined: 2005-09-20 22:39
Location: Saint-Petersburg, Russia

Re: HOWTO: Install X Window System and a Desktop Environment

Postby Scotti » 2007-02-21 13:58

aim wrote:don't you think it's not so good to install full bloated gnome? why not install tiny gnome-core (or kde-core) and add software on-demand (for example iceweasel, iceweasel-gnome-support and etc.?


Hi aim,

Yes, I agree with you on this. However, when I wrote this I kept the new user in mind. Someone who may be completely new to Debian and who is just getting used to the concept of "apt-getting" new software. I kept things as simple as possible. And when the user has their full Gnome desktop (as bloated as it may be) they will have everything they need to start using and learning about their new Debian GNU/Linux computer.

Later on in the Notes section I make mention of a minimal Gnome and KDE installation, too.
Scotti
Moderator Team Member
 
Posts: 312
Joined: 2005-11-08 01:13

Re: HOWTO: Install X Window System and a Desktop Environment

Postby aim » 2007-02-21 14:11

Scotti wrote:
aim wrote:don't you think it's not so good to install full bloated gnome? why not install tiny gnome-core (or kde-core) and add software on-demand (for example iceweasel, iceweasel-gnome-support and etc.?

Yes, I agree with you on this. However, when I wrote this I kept the new user in mind.


I think it's a wrong thing to install all that stuff... Just an example.

KDE metapackage install kde-multimedia which depends on "juk". Juk? Huh... It's an old stuff, everybody using amarok now! Nube will be shocked if you show him juk. he will say -- oh, no. debian contains a lot of crap software (sorry juk guys, i was not to hit you, but amaroK is MUCH better) - i will switch to kubuntu instead of debian "etch".

an so on.

we (people who know) should be *very* carefull in writing such HOWTOs to prevent users leave debian. It's a market and a war!
User avatar
aim
 
Posts: 12
Joined: 2005-09-20 22:39
Location: Saint-Petersburg, Russia

The good oil

Postby railpost » 2007-03-05 02:45

Many thanks for your information and how to-s...Is there any way this info can be made plainly available to new people like myself and prevent us from clogging up the forum with questions..

Maybe this could be placed in the Debian manual.. Its is a lot better than the formal not very helpful thing you guys have at the moment..

This how to answered all my questions as did the helpful links...

Again many thanks..I will now continue on with Debian rather than switching to another distro...

No war is one at the first shot, to the most informed goes the victory..
railpost
 
Posts: 3
Joined: 2007-03-04 14:27

Next

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: Majestic-12 [Bot] and 8 guests

fashionable