Differences between revisions 6 and 7
Revision 6 as of 2009-03-16 13:01:19
Size: 19769
Editor: hughszg
Comment:
Revision 7 as of 2012-06-12 09:16:19
Size: 19875
Editor: tuhaihe
Comment:
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
Keywords: Debian GNU Linux, 手册, How To, How-To,howto, 安装,配置,容易,由Windows XP到Debian,无线WPA2, anti-spam, fax, MoinMoin Wiki, Linux, 服务器,Windows, Windows NT, 文档, HowTo, vmware, vmwaretools, vmware tools, vm, 工具, AMD64, 64 bit

= Debian Services =
= FTP
服务器 =
关键词: Debian GNU Linux, 手册, How To, How-To,howto, 安装,配置,容易,由Windows XP到Debian,无线WPA2, 反垃圾邮件, 传真, MoinMoin Wiki, Linux, 服务器,Windows, Windows NT, 文档, HowTo, vmware, vmwaretools, vmware 工具, vm, 工具, AMD64, 64

= Debian 服务器 =
= FTP 服务器 =
Line 15: Line 15:
 * 安装Ftp服务器(“非常安全的ftp服务器”)  * 安装 Ftp 服务器(vsftpd:“非常安全的 ftp 服务器”)
Line 21: Line 21:
== 配置 ==
 * 现在配置的服务器
 * 编辑/etc/vsftpd.conf
=== 配置 ===
 * 现在配置的服务器
 * 编辑 /etc/vsftpd.conf
Line 43: Line 43:
= 相册服务器 =
== 安装 ==
== 相册服务器 ==
=== 安装 ===
Line 61: Line 61:
== 配置 ==
 * 现在你要在apache2的配置里应用gallery2.
 * 将/etc/apache2/conf.d/gallery里的如下行前面的#去掉
=== 配置 ===
 * 现在你要在 apache2 的配置里应用 gallery2
 * 将 /etc/apache2/conf.d/gallery 里的如下行前面的#去掉
Line 67: Line 67:
 * [FYI]/etc/apache2/conf.d/gallery是一个到/etc/gallery2/apache.conf的链接
*现在重启或启动的apache服务器
 * [FYI]/etc/apache2/conf.d/gallery 是一个到 /etc/gallery2/apache.conf的链接
*现在重启或启动 apache 服务器
Line 73: Line 73:
 * 现在访问http://localhost/gallery2 你应该能看到你的gallery2的配置页面了。
== Gallery2 配置 ==
 * 安装安装过程并遵循指示。
 * 然后会让你复制到或在/usr/share/gallery2目录下创建login.txt。下载login.txt并复制到那个文件夹下。
 * 现在访问 http://localhost/gallery2 你应该能看到你的 gallery2 的配置页面了。
=== Gallery2 配置 ===
 * 开始安装过程并遵循指示。
 * 然后会让你复制到或在 /usr/share/gallery2 目录下创建 login.txt。下载 login.txt 并复制到那个文件夹下。
Line 89: Line 89:
 * 如果你需要创建gallery2数据库。登陆mysql  * 如果你需要创建 gallery2 数据库。登陆 mysql
Line 99: Line 99:
== Gallery2组件 == === Gallery2组件 ===
Line 101: Line 101:
 * 如果你要安装一些程序可以输入这个命令:  * 如果你要安装一些程序可以输入这个命令:
Line 105: Line 105:
 * 完成。你应该在http://localhost/gallery2 下拥有你的图库了。
 * '''[可选 ]''' 如果你想将它改成其它名称,如http://localhost/photos ,编辑/etc/apache2/conf.d/gallery2并添加一行如:
 * 完成。你应该在 http://localhost/gallery2 下拥有你的图库了。
 * '''[可选 ]''' 如果你想将它改成其它名称,如 http://localhost/photos ,编辑/etc/apache2/conf.d/gallery2 并添加一行如:
Line 110: Line 110:
== 管理相片 ==
 * 现在可以管理相片了。
 * 用管理帐户登陆并在的相片服务器上添加文件
= VMware Server On Debian =
=== 管理相片 ===
 * 现在可以管理相片了。
 * 使用管理帐户登陆并开始的相片服务器上添加文件
== Debian 上的 VMware 服务器==
Line 115: Line 115:
 * See [[VMware]] article.
{{
http://lucasmanual.com/out/Debian-vmware-windows-xp.jpg}}

== VMware Kernel Upgrade ==
[[http://lucasmanual.com/out/Debian-vmware-windows-xp.jpg]]

* 查看 [[VMware]] 文章。

=
== VMware 内核升级 ===
Line 130: Line 131:
= Debian配置 =
== 由dhcp更改为静态ip ==
 * 编辑/etc/network/interfaces
 * 将#号加到iface eth0 inet dhcp一行的前面并在下面输入:
= Debian 配置 =
== 由 dhcp 更改为静态 ip ==
 * 编辑 /etc/network/interfaces
 * 将#号加到 “iface eth0 inet dhcp一行的前面并在下面输入:
Line 161: Line 162:
= Subversion = == Subversion ==

Translation(s): English,Français,Dutch,Deutsch,简体中文

(!) ?/Discussion


如何在Debian上安装各种软件。一步一步来。

关键词: Debian GNU Linux, 手册, How To, How-To,howto, 安装,配置,容易,由Windows XP到Debian,无线WPA2, 反垃圾邮件, 传真, MoinMoin Wiki, Linux, 服务器,Windows, Windows NT, 文档, ?HowTo, vmware, vmwaretools, vmware 工具, vm, 工具, AMD64, 64 位

Debian 服务器

FTP 服务器

安装

  • 安装 Ftp 服务器(vsftpd:“非常安全的 ftp 服务器”)

aptitude update
aptitude install vsftpd
  • Ftp服务器已经安装上了

配置

  • 现在配置您的服务器
  • 编辑 /etc/vsftpd.conf

vi /etc/vsftpd.conf
  • [可选] 可以通过找到anonymous_enable=YES 并将其改成以下配置来禁用匿名帐户

anonymous_enable=NO
  • [可选] 允许写权限(上传权限)。找到以下行并将其前面的#去掉:

write_enable=YES
  • [可选] 当人们登陆时显示你的横幅。找到#ftpd_banner=Welcome to blah FTP service. 将其前面的#去掉并改写成如:

ftpd_banner=Welcome to example.com FTP service. Enjoy.
  • [可选] 允许本地用户登陆。将以下行前的#去掉:

local_enable=YES

相册服务器

安装

  • [可选] 您应该已经安装了apache,mysql和php。如果还没有,请将它们安装。

apt-get update
apt-get install apache2
apt-get install mysql-server
apt-get install php5
apt-get install php5-mysql
  • 开始。
  • 安装图画软件

apt-get update
apt-get install gallery2
  • 输入数据库根密码。
  • 安装完成。

配置

  • 现在你要在 apache2 的配置里应用 gallery2。
  • 将 /etc/apache2/conf.d/gallery 里的如下行前面的#去掉

Alias /gallery2 /usr/share/gallery2
  • [FYI]/etc/apache2/conf.d/gallery 是一个到 /etc/gallery2/apache.conf的链接

*现在重启或启动您的 apache 服务器

/etc/init.d/apache2 restart

Gallery2 配置

  • 开始安装过程并遵循指示。
  • 然后会让你复制到或在 /usr/share/gallery2 目录下创建 login.txt。下载 login.txt 并复制到那个文件夹下。

cp /home/lucas/Desktop/login.txt /usr/share/gallery2/
  • 到下一步,选择标准安装

  • 现在选择一个你将用来存储图片和电影等的文件夹。

mkdir /usr/share/gallery2/g2data
chmod 755 /usr/share/gallery2/g2data
chown www-data:www-data /usr/share/gallery2/g2data
  • 第一步是创建一个文件夹,第二步是将其变成用户可写模式,第三步是将其拥有者改为网络服务器。
  • 输入数据库的密码
  • 如果你需要创建 gallery2 数据库。登陆 mysql

mysql -u root -p
  • 输入此命令:

create database gallery2;
  • 创建一个管理帐户
  • 现在轮到了gallery2组件部分。

Gallery2组件

  • 他们都已被选中,所以翻看一遍列表并将你不用的选项禁用掉。(commerce print cars, new user registration, quotas, etc)
  • 如果你要安装一些程序,可以输入这个命令:

apt-get install imagemagick

Alias /photos /usr/share/gallery2

管理相片

  • 现在您可以管理相片了。
  • 使用管理员帐户登陆并开始在您的相片服务器上添加文件

== Debian 上的 VMware 服务器==

  • Very good how-to which didn't require from me any additional configuration to install vmware on debian and then windows xp as a guest os is here:

http://lucasmanual.com/out/Debian-vmware-windows-xp.jpg

* 查看 VMware 文章。

VMware 内核升级

  • On an upgrade when your kernel has been updated you need to download the kernel headers and reconfigure vmware.

aptitude update
aptitude install linux-headers-$(uname -r)
/usr/bin/vmware-config.pl

VMware on amd64

  • 要将vmware安装到amd64上你必须再额外安装一些库文件:

aptitude install linux-headers-`uname -r` libx11-6 libx11-dev x-window-system-core x-window-system xspecs libxtst6 psmisc build-essential ia32-libs

Debian 配置

由 dhcp 更改为静态 ip

  • 编辑 /etc/network/interfaces
  • 将#号加到 “iface eth0 inet dhcp” 一行的前面并在下面输入:

iface eth0 inet static
[tab]address 192.168.1.200
[tab]network 192.168.1.0
[tab]netmask 255.255.255.0
[tab]broadcast 192.168.1.255
[tab]gateway 192.168.1.1
  • 你的文件应该是这样的了:

#iface eth0 inet dhcp
iface eth0 inet static
    address 192.168.1.200
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
  • 或者

iface eth0 inet static
    address 192.168.5.200
    network 192.168.5.0
    netmask 255.255.255.0
    broadcast 192.168.5.255
    gateway 192.168.5.254

Subversion

  • Svn是一个可以管理任何数据的软件。它会监测数据的更改,让你更新数据,且如果出现任何错误你可以轻易地倒回去。
  • 让我们在Debian上安装它:

apt-cache search svn
aptitude install subversion
  • Subversion安装上了
  • 你可以这样使用它:我有一个正在工作中的项目。它位于

/home/lucas/my_best_project
  • 这个文件夹包含

/home/lucas/my_best_project/trunk/install.c
/home/lucas/my_best_project/trunk/readme.txt
  • I keep my working files in trunk. I want it in subversion now!
  • We need to tell subversion where it can store its repositories:
  • It will be in

/usr/local/src/
  • Now create repository directory:

svnadmin create /usr/local/src/my_best_project
  • Now I am going to import my_best_project to svn

svn import /home/lucas/my_best_project file:///usr/local/src/my_best_project -m "initial import"
  • Folder /home/lucas/my_best_project is not important anymore. SVN is not concerned what you are going to do with it.

  • Now we need to start working with subversion and we do that by creating a folder where we can work on my best project with subversion. It will be in /home/lucas/new_folder/ We need to go to that folder. And from that folder we issue command:

svn checkout file:///usr/local/src/my_best_project
  • Now it created

/home/lucas/new_folder/my_best_project
  • This folder contains files I kept in a trunk. I can now work on it and let svn take care the version tracking.

* Optional, you could use subversion over ssh. You need to install subversion on your computer and then:

svn co svn+ssh://your.remote-server.com/usr/local/src/my_best_project

* Done. Now its time to make that tool great.

Ati binary driver

Steps borrowed from Michael Schurter's blog. Tips borrowed from Gentoo wiki.

  • Step 0: Install the required packages (you may need to add "non-free" to /etc/apt/sources.list)

aptitude update
aptitude install fglrx-control fglrx-driver fglrx-kernel-src module-assistant mesa-utils
  • Step 1: Change to kernel and kernel module source code directory.

cd /usr/src
  • Step 2: Prepare your system to build new kernel modules.

module-assistant prepare
  • Step 3: Build the fglrx kernel module.

module-assistant a-i fglrx
  • Step 4: Make a copy of your xorg.conf file:

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.todaysdate
  • Step 5: Edit your /etc/X11/xorg.conf file, and set your display driver to fglrx
  • Locate the device section and add the corresponding lines Section "Device".

Section "Device"
   Driver "fglrx"
   Option "VideoOverlay" "on"
EndSection
  • Driver line is probably currently set to "radeon" or "ati". Remember which name you have because you will use it in step #7.
  • Also enable XVideo in Extentions

Section "Extensions"
   Option "XVideo" "Enable"
EndSection
  • Step 5: Exit Gnome (or KDE, just get out of X Windows), press ctrl-alt-F1 to get a console, login as root.
  • Step 6: Stop Gnome Display Manager:

/etc/init.d/gdm stop

Or KDE Display Manager

/etc/init.d/kdm stop

Or X Display Manager

/etc/init.d/xdm stop
  • Step 7: Remove the old kernel module

modprobe -r radeon
  • Step 8: 载入新的内核模块

modprobe fglrx
  • Step 9: 启动显示管理器(gdm可以替换成kdm或xdm)

/etc/init.d/gdm start
  • Step 10: 测试3d加速

glxinfo | grep direct
  • Step 11: 测试xvideo插件

xvinfo

挂载Windows共享

  • 你需要安装了smbfs。如果还没有,请输入:

aptitude update
aptitude install smbfs
  • 要挂载windows共享磁盘你需要创建一个文件夹:

mkdir somefolder
  • 在根用户下或以根用户权限(su root or sudo)

mount -t smbfs -o username=administrator,password=password
//windowsservername/folder /home/lucas/somefolder

如果你不希望出现密码输入提示,你可以输入

mount -t smbfs -o username=administrator //windowsservername/folder /home/lucas/somefolder

[可选] 你可以用你的用户名替换掉管理员帐户。你也可以用ip地址//192.168.1.10/folder替换掉windowsservername……

添加网卡

  • 查看你的网卡是否在列表内:

lspci -v
  • 以硬件数字添加网卡。用你的硬件数字替换掉00:00:..:00。它应该是一组16位的字母。

ifconfig eth1 hw erher 00:00:..:00 uo

Raid 1 Setup

http://lucasmanual.com/mywiki/DebianRAID

Power Users

Sudo

  • 如果sudo命令未安装,把它安装上。

aptitude update
aptitude install sudo
  • 然后运行visudo

visudo
  • 复制root ALL=(ALL) ALL并将其粘贴到以下位置,然后在粘贴后的行上将根帐户更改为你的用户名。

yourusername    ALL=(ALL) ALL

禁用ssh根权限

  • 编辑文件sshd_config

vi /etc/ssh/sshd_config
  • 在某一行你会看到 ?PermitRootLogin,将其后字符改为no

PermitRootLogin no
  • 重启或重新载入ssh

/etc/init.d/ssh force-reload
  • This will prevent other users from trying to get guess your password. 100s of lines on your system that look:

Security Events
=-=-=-=-=-=-=-=
Feb  5 07:21:15 localhost sshd[8586]: Failed password for root from xx.xx.xx.xx port 60618 ssh2
Feb  5 07:21:15 localhost sshd[8588]: Failed password for root from xx.xx.xx.xx port 60637 ssh2

Debian上的AWStats

  • 安装AWStats

aptitude update
aptitude awstats
  • 为awstats配置apache2
  • 为apache2复制配置文件。

cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf.d/awstats
  • 然后编辑文件/etc/awstats/awstats.conf 并确保文件中包含以下字段(确信有apache2一词)

LogFile="/var/log/apache2/access.log"
SiteDomain="mysite.org"
LogFormat=1
  • Now change a permission on apache log file

chmod o+r /var/log/apache2/access.log
  • Make it a default that access.log has these permissions.
  • Edit the /etc/logrotate.d/apache2 and make sure it has these lines

 create 644 root adm
  • And

prerotate
    /usr/lib/cgi-bin/awstats.pl -config=awstats.www.mysite.org.conf  -update
  endscript
  • Final file should look similar to :

/var/log/apache2/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 644 root adm
        sharedscripts
        prerotate
            /usr/lib/cgi-bin/awstats.pl -config=awstats.conf -update        endscript
        postrotate
                if [ -f /var/run/apache2.pid ]; then
                        /etc/init.d/apache2 restart > /dev/null
                fi
        endscript
}
  • Reload apache

/etc/init.d/apache2 reload
  • And visit:

http://localhost/cgi-bin/awstats.pl?config=awstat.conf or http://www.mysite.com/cgi-bin/awstats.pl?config=awstat.conf [Optional]

  • To make it easier to remember the address you can edit /etc/apache2/conf.d/awstats and add this line.

RedirectMatch ^/logs /cgi-bin/awstats.pl?config=awstat.conf
  • Now you can access the awstats statistics by going to

http://www.mysite.com/logs

  • Done.

unixODBC

  • Install odbc, and mssql drivers (tdsodbc)

aptitude update
aptitude install tdsodbc unixodbc
  • Create a driver template.

vi /etc/freetds/tds.driver.template
  • Inside add :

[TDS]
Description     = FreeTDS Driver for Linux & MSSQL on Win32
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
  • Now dsn file:

vi /etc/freetds/tds.dsn.template
  • And inside add:

[DSN_NAME]
Description     = Descripton of you DSN connection.
Driver          = TDS
Trace           = No
Database        = DefaultDatabase [replace with your database name]
Server          = mysqlserver.inter.net [replace with your SQL server's host,ip]
Port            = 1433 [replace with the port that SQL is listening on]
  • Now run this command to add your driver to unixodbc

odbcinst -i -d -f /etc/freetds/tds.driver.template
  • Now you add dsn. You have 2 options.
  • Add system DSN for all users

odbcinst -i -s -l -f /etc/freetds/tds.dsn.template
  • Add dsn to a user your are running a command on:

odbcinst -i -s -f /etc/freetds/tds.dsn.template
  • Now test your connection:

isql -v DSN_NAME username password
  • You should get something like

**********************************************
* unixODBC - isql                            *
**********************************************
* Syntax                                     *
*                                            *
.
.
.
more
.

Troubleshooting

  • If you can not connect it is probable that your database is listening on a different port.
  • Try this:

telnet myserver 1433
  • You should see something like:

Trying 10.3.3.10...
Connected to myserver.
Escape character is '^]'.
  • type quit to exit. Replace 1433 with a port number, replace myserver with your servers name. If you still get connection refused try telnet from windows and see if you get same answer.

Apt Preferences

vi /etc/apt/preferances
  • And inside put these lines. Change the Pin-Priority to reflect your default install.
  • If you are using testing Debian make sure testing is the bigger number.
  • This file will install only from the highest pin but it will show you if the packages is available in testing or unstable

Package: *
Pin: release a=stable
Pin-Priority: 600
Package: *
Pin: release a=testing
Pin-Priority: 450
Package: *
Pin: release a=unstable
Pin-Priority: 400
  • Now add testing and unstable to /etc/apt/source.list by coping and paste deb and deb-src lines and change stabel to testing, and then again stable to unstable.

  • Update list

aptitude update
  • Debian User Configuration

更改默认编辑器

  • 安装你的编辑器
  • 例子:

aptitude update
aptitude install vim
  • 运行配置更改

update-alternatives --config editor
  • 从列表中选择你的编辑器。完事。

更改默认pdf查看器

  • 安装你的pdf查看器
  • 在一个pdf文件上右击鼠标
  • 更改:‘属性->打开方式’成你的pdf查看器。

查看已安装的浏览器插件

  • 在浏览器地址栏输入“about:plugins”

Java Runtime Enviroment (JRE) AMD64

  • Download jre for x64 JREx64

  • Run the bin file, after agreeing to the license it will extract the files.

cd /usr/local/src/
mkdir JREx64
cd JREx64
#put the file here
sh ./jre-6u12-linux-x64.bin
cd /usr/lib/mozilla/plugins/
sudo ln -s /usr/local/src/JREx64/jre1.6.0_12/lib/amd64/libnpjp2.so
  • You are ready to go. Laptop and Debian

用PSK TKIP进行wpa验证

* 安装wpasupplicant

aptitude update
aptitude install wpasupplicant

* 打开/etc/network/interfaces

vi /etc/network/interfaces

*如果你看到了"iface eth2..." ,将以下字段添加到下面,但要更改ssid和password:

iface eth2 inet dhcp
wpa-ssid thisismynetworkname
wpa-psk thisismypassword

*退出,然后输入:

ifup eth2

*完成了。如果你希望每次你的电脑启动时无线网卡就连接到因特网上,请在"iface eth2.."上面添加

auto eth2

*完成了。[可选](see the WPA page for status on wpa support in debian)

Intel显卡-更高的分辨率

<!> DebianLenny 及以后的发行版不需要。Support is included within xserver-xorg-video-intel.

  • install 915resolution

aptitude install 915resolution
  • 查看都有哪些分辨率可用

915resolution -l
  • 如果你想要的分辨率不在列表中,你需要运行dpkg-reconfigure xserver-xorg 并添加新的分辨率。

  • 例如 (使用5c模式1920x1440):

sudo 915resolution 5c 1280 800 24

Troubleshooting

SSH terminal connection timeout

  • If you get an error:

Read from remote host example.com: Connection reset by peer
Connection to example.com closed
  • Edit /etc/ssh/sshd_config and add:

ClientAliveInterval 150

Dynamic MMap ran out of room

  • If you see an error like:

Reading package lists... Error!
E: Dynamic MMap ran out of room
E: Error occurred while processing vlc (NewVersion1)

apt-get update -o APT::Cache-Limit=25165824
  • Useful Debian Programs

Digital Camera

* Digikam, for all your digital camera needs

aptitude update
aptitude install digikam

播放器和查看器

Flash

  • For Flash support you need to add contrib to /etc/apt/sources.list , then

aptitude update
aptitude install flashplugin-nonfree

How to Remote connect to windows

  • You can connect to Microsoft Windows Remote Connection via rdesktop
  • Install rdesktop

aptitude update
aptitude install rdesktop
  • Then you can start rdesktop or from a command line

rdesktop ip.add.re.ss
or
rdesktop remoteconnection.example.com