Xorg/Guide/ja

Xorgは、簡単に操作可能なGUI環境をユーザーに提供してくれる、X Window serverです. このガイドでは、Xorgとは何か、Xorgのインストール方法、各種設定について説明します.

GUI vs GLI
平均的なユーザはコマンドを入力するというとギョッとするでしょう. Gentoo(や、Linux一般において)によって提供される自由な世界をポイントし、クリックして進んでゆくことは出来ないのでしょうか? いや、もちろんできます! Linuxは既存のインストール上にインストール可能な数々の華やかなインターフェースと環境を提供しています.

これは新規ユーザーが遭遇する最も大きな驚きのうちの一つです、つまり、グラフィカルユーザーインターフェースはシステムの上で動く一つのアプリケーションでしかないということです. これはLinuxカーネルや他の内部システムの一部ではありません. あなたのワークステーションにグラフィカルな能力を最大限発揮させてくれるパワフルなツールです.

規格といものは重要なように、描画、スクリーン上でのウィンドウの移動、マウスやキーボードや他の基本的で、しかし重要なものの規格がつくられ、そして"X11"や単に"X"とよく呼ばれる"X Window System"が名付けられました. これは世界中でUnix, Linux, そしてUnixライクなOSで使われています.

アプリケーションはLinuxユーザーにGUIを動かす機能を提供し、それはX11規格としてXorg-X11、XFree86プロジェクトのフォーク、を使っています. XF43386はGPLライセンスとは互換性のないライセンスを使ってます. ので、Xorgの使用が推奨されます. 公式PortageツリーはもはやXFree86の提供をしていません.

X.org プロジェクト
X.orgプロジェクトがつくられ、自由に配布可能な、X11システムのオープンソース実装を管理しています. これがオープンソースのX11ベースデスクトップ基盤です.

Xorgは実行したいグラフィカルソフトウェアとハードウェアの間のインターフェースを提供します. にしても、Xorgは完全なネットワーク意識でもあります. つまり、アプリケーションをあるシステムで実行しつつ、それと異なるシステムで見ることが可能です.

インストール
Xrogのインストールの前に、システムの準備をする必要があります. まず、ビデオカードとインプットデバイスサポートのためにカーネルセットアップを行いましょう. それから、正しいドライバとXorgパッケージがビルドされ、インストールされるためにを準備しましょう.

インプットドライバサポート
デフォルトでは、Xorgは一般的入力ドライバである を使います. カーネル設定を変更することで のサポートを有効化する必要があります. もしカーネル設定の方法がわからなければKernel Configuration Guideを読んでください.

カーネルモード設定
モダンなオープンソースビデオドライバはカーネルモード設定(KMS)に依存しています. KMSはちらつきの少ないグラフィカルブート、早い応答性、ビルトインフレームバッファーコンソール、コンソールからXorgへの滑らかな切り替えや他の機能を提供します.

まず、KMSのためにカーネルを準備してください. このステップはどのXorgビデオドライバが使われるかにはよりません.

つぎに、ビデオカードに正しいKMSドライバをカーネルが使うよう設定してください. Intel、nVidiaやAMD/ATIはよくあるカードなので、下に示したカード毎のコードに従ってください.

インテルのカードについてはkernel section of the Intel articleを見てください.

nVidiaカード:

新しいAMD/ATIカードについては(RadeonHD 2000 and up)や, emerge やを実行してください. これらパッケージがインストールされたら、Radeon articleのfirmware sectionに詳解されているようにカーネルを設定してください.

カーネル設定を出て、カーネル再ビルド、再起動しましょう.

Now that KMS has been set up, continue preparing in the next section.

make.conf configuration
Now that the kernel is prepared, two important variables in the file must be configured before installing Xorg.

The first variable is VIDEO_CARDS. This is used to set the video drivers that you intend to use and is usually based on the kind of video card you have. The most common settings are  for nVidia cards or   for ATI cards. Both have actively developed, well-supported open-source drivers.

The  driver may be used for desktops or laptops with common Intel integrated graphics chipsets.

The second variable is INPUT_DEVICES and is used to determine which drivers are to be built for input devices. In most cases setting it to  should work just fine. If you use alternative input devices, such as a Synaptics touchpad for a laptop, be sure to add it to INPUT_DEVICES.

Decide which drivers will be used and add necessary settings to the file:

If the suggested settings does not work emerge the package(see the step below). Check all the options available and choose those which apply to the system. This example is for a system with a keyboard, mouse, Synaptics touchpad, and a Radeon video card.

After setting all the necessary variables Xorg can be installed:

When the installation is finished, some environment variables will need to re-initialized before continuing. Source the profile with this command:

NVidia users
For NVidia users it might be beneficial to run in order to generate a working  file for the selected graphics card. Without this step the file will need to be created manually as described below. Missing the will sometimes generate a "No screens found" error to the terminal when attempting to.

Also the NVidia driver will only work after a reboot, so be sure to restart the system after running.

It is both possible and recommended to set the OpenGL renderer to the hardware renderer instead of a software renderer:

設定
The X server is designed to work out-of-the-box, with no need to manually edit Xorg's configuration files. It should detect and configure devices such as displays, keyboards, and mice.

Try using startx without editing any configuration files. If Xorg will not start, or there is some other problem, then manual configuration of Xorg will be needed. This is explained in the following section.

xorg.conf.d ディレクトリー
Most of the configuration files for Xorg are stored in. Each file is given a unique name and ends in. The file names in Xorg's configuration directory will be read in alpha numeric order. For example, will be read before ;  will be read before, and so on. The files in this directory are not required to be numbered, but doing so will help to keep them organized. Organization is helpful when debugging faulty configuration files.

startx を用いる
Try to start up the X server. is a script (it's installed by ) that executes an X session; that is, it starts the X server and some graphical applications on top of it. It decides which applications to run using the following logic:


 * If a file named exists in the home directory, it will execute the commands listed there.


 * Otherwise, it will read the value of the XSESSION variable from the file and execute the relevant session accordingly. Values for XSESSION are available in . To set a system wide default session run:




 * This will create the file and set the default X session to Xfce. Remember to run  after making changes to.

If no window manager has been installed a solid black screen will appear. Since this can also be a sign that something is wrong, the and  packages can be installed only to test X.

Once the programs are installed, run again. A few windows should appear, making it easy to verify the X server is working correctly. Once satisfied with the results, unmerge and  if installed in the step above to remove the testing packages. They will not be needed to setup a proper desktop environment.

The session (program to start) could also be given as an argument to :

You can also pass X11 server options, by preceding them with a double dash:

画面の解像度を設定する
If the screen resolution looks to be wrong, you will need to check two sections in your configuration. First of all, you have the Screen section which lists the resolutions that your X server will run at. This section might not list any resolutions at all. If this is the case, Xorg will estimate the resolutions based on the information in the second section, Monitor.

Now let us change the resolution. In the next example from we add the   line so that our X server starts at 1440x900 by default. The  in the   section must match the name of your monitor, which can be obtained by running. Install  just long enough to get this information. The argument after the monitor name (in the  section) must match the   in the   section.

Run X to discover it uses the desired resolution.

マルチディスプレイ
More than one monitor in can be established in. Give each monitor a unique identifier, then list its physical position, such as "RightOf" or "Above" another monitor. The following example shows how to configure a DVI and a VGA monitor, with the VGA monitor as the right-hand screen:

キーボードの設定
To setup X to use an international keyboard create the appropriate config file in. This example features a Czech keyboard layout:

For methods of switching the keyboard layout see the Keyboard layout switching article.

The "terminate" command lets users kill the X session by using the ++ key combination. This will, however, make X exit disgracefully -- something that users might want to avoid. It can be useful when programs have frozen the display entirely, or when configuring and tweaking the Xorg environment. Be careful when killing the desktop with this key combination - most programs really do not like it when they are ended this way. Some, if not all, of the information that has not been written to the disk (information stored in "open documents") will be lost.

仕上げ
Run and be happy about the result. Congratulations, you now (hopefully) have a working Xorg! The next step is to install a useful window manager or desktop environment such as KDE, GNOME, or Xfce. Information on installing these desktop environments can be found here on the wiki.

参照

 * Wayland - The next generation window manager for Linux.
 * X (Security Handbook) - The Security Handbook's entry on securing the X server.

Creating and editing config files
First of all, and  provide quick yet complete references about the syntax used by these configuration files. Be sure to have them open on a terminal when editing Xorg configuration files!

There are also many online resources on editing config files in. Only a few are listed here; use a choice favorite search engine to find more.

Other resources
More information about installing and configuring various graphical desktop environments and applications can be found in the section of our documentation.

When upgrading to xorg-server 1.9 or higher, be sure to read the migration guide.

X.org provides many FAQs on their website, in addition to their other documentation.