LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: minus273

Slackware tips and tricks 集锦

[复制链接]
发表于 2005-11-29 02:09:12 | 显示全部楼层

slackware贴士

配制工具pkgtool:
Current: Install packages form the current directory #安装来自基本软件包(一般指光盘附带内容)

Other:    Install packages form some other  directory #安装其它部分软件包(可能来自网络或本地硬盘)

Floppy:   Install packages form floppy disks #安装来自软盘的软件包

Remove: Remove packages that are currently installed #删除已安装的软件

View:      View the list of  files contained in a packages #浏览或列出已安装的软件部分

Setup:    Choose Slackware installation scripts to run again #对Slackware运行脚本并进行设置

Exit:        Exit pkgtool #退出pkgtool工具

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2005-11-29 02:22:38 | 显示全部楼层

SELECT SYSTEM SETUP SCRIPTS

05. fontconfig run fc-cache to locate new fonts for Xft #运行fc-chache 以对新安装的字体进行设置并更改本地字体设置。

70. install-kern Install a Linux kernel form a bootdisk #安装一个Linux内核来自启动盘

80.make-bootdis Create a Linux boot floppy #制作一张可启动的映像软盘

90. modem-device Select mode device #选择和设置modem驱动并账号

hotplug Enable/disable hotplug activation at boot #激活或终止硬件检测启动进程管理

liloconfig Set up LILO to boot Linux(and other OSes) #l设置Linux的Lilo或其它启动选项

mouse Configure the console mouse support (GPM) #设置鼠标端口及配置鼠标

netconfig Configure basic network settings #配置网格及上网方式

services Select/deselect system daemons (services) #选择或取消系统服务守护进程管理

setconsolefont Select a font for the console #选择在控制台中所使用的字体

timeconfig Seect your timezone #设置你的时区

xwmconfig Choose a default window manager for X #设置你默认使用的X窗口管理器如fvwm、KDE等

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2005-11-29 02:32:35 | 显示全部楼层

本地设置

中文或其它语种本地设置在/etc/profile.d/lang.sh
#!/bin/sh
# Set the system locale.  (no, we don't have a menu for this ;-)
# For a list of locales which are supported by this machine, type:
# locale -a

# zh_CN is the Slackware default locale:
# export LANG=zh_CN.GB18030 #设置默认的本地编码

# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968.  These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
# export LANG=C #二进制码本地设置(一般不作更改)

# There is also support for UTF-8 locales, but be aware that
# some programs are not yet able to handle UTF-8 and will fail to
# run properly.  In those cases, you can set LANG=C before
# starting them.  Still, I'd avoid UTF unless you actually need it.
  export LANG=zh_CN.GB18030 #对UTF-8编码设置,或作全局变量申明

# Another option for en_US:
# export LANG=en_US.ISO8859-1

# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
# change in many places.  Since this isn't usually expected and
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
# export LC_COLLATE=C

# End of /etc/profile.d/lang.sh

以上文件是默认配置文件,风格非常规范且工整,但一般不需要还过详细,只需对以上红色部分作更改即可。在这里,我将本地设置定义为GB18030。这里没有决对标准,可接自己的意愿进行设置为UTF-8或GBK都可以。
回复 支持 反对

使用道具 举报

发表于 2005-11-29 02:47:07 | 显示全部楼层

Fcitx输入法设置

一、定义XMODIFIERS

在/etc/profile中增加以下部分内容:

#INPUT OF CHINSES EXPORT
export LC_CTYPE="zh_CN.GBK"
export XMODIFIERS="@im=fcitx“

因本人在全局变量本地设置中使用的是GB18030所以在这里我需把LC_CTYPE设置为zh_CN或zh_CN.GBK后,(zh_CN.GBK更好一些)输入法才起作用,另外这样这可实现以英文系统实现中文输入成为可能。本人将本地设置环境变量设置为GB18030是因希望能处理更多的中文汉字,比如堃、噰、嗞等非常用汉字。使用UTF-8或其它编码是可以输入它们,但会在一些情况下出现一个汉字占用4个字符的情况,或在一些软件中这些汉字根本就打不上去如OpenOffice等,而GB2312则不需用这一部分,但可识别的汉字很少。

注:我习惯对系统进行全局变量设置,因此将XMODIFIEFS增加到/etc/profile文件中,但有些人习惯把它写入~/.profile或bashrc文件中,这是个人习惯。
回复 支持 反对

使用道具 举报

发表于 2005-11-29 03:00:42 | 显示全部楼层

添加中文字体或设置

在slackware10.2中,没有使用gnome环境,因此在/usr/share/目录下没有fonts目录,同样如果将字体放入这里,slackware是不会使用这些字体的,即便是在/etc/fonts/fonts.conf设置或在/etc/X11/xorg.conf设置它仍不会有好的效果。

方法一:
slackware10.2与FreeBSD或其它BSD一样,字体目录路径在/usr/X11R6/lib/X11/fonts下。通常可以把你所需要的字体如文泉驿或MS的SimSun字体copy到/usr/X11R6/lib/X11/fonts/TTF或自建一个文件夹中并在/etc/X11/xorg.conf文件增加的字体目录路径名,如/usr/X11R6/libX11/fonts/zh_CN之类的,并在以根用户身分运行/usr/X11R6/bin/fc-cache -f 或再加一个-v选项回显设置过程,如/usr/X11R6/bin/fc-cache -f -v 。

使用一个简单的方法二:
在KDE控制中心──系统管理──字体安装程序,以管理员身份运行,把需要增加的字体装上,系统会自动帮助你解决问题。

方法三(设置字体)
copy字体后,第三种方法是在终端中以根身分运行pkgtool工具进入Setup后把05.fontsconfig选上后,系统将运行fc-cache设置你的系统字体,并自动更改/etc/fonts/fonts.config文件。

我就是按照第一种方法这么做的,不需要再次对/etc/fonts/fonts.conf文件再次进行手动更改,以经可以达到windwos中文环境的效果,如果你还不满意,那就自己去改/etc/fonts/fotns.conf文件吧。
回复 支持 反对

使用道具 举报

发表于 2005-11-29 03:32:54 | 显示全部楼层

启动进程管理

slackware是使用4.4BSD-list风格的Linux发行版,因此启动进程管理与其它发行版不同。

通过slackware内核将许多可用的设备支持作为模块编入(是为了提供更大的方便,为在你增加其它设备及服务时,不需要去重新编译内核,以保证系统安全性或为降低因人为错误导致系统崩溃的可能性)。哪内核是否会因此而感到臃肿!答案是不会,因为虽然以将多数不存在的设备编入内核模块,但决定真正启动的内核模块进程在/etc/rc.d目录下面,其中有一个非常重要的配置文件将决定你的系统加载什么样的设置及服务,即是/etc/rc.d/rc.modules文件。不知是否注意到,有很多Fans在安装和设置好系统后,去自己下载如ATI的显卡并重新去编译内核,希望实现3D加速或认为没有显示驱动导致屏幕很闪,或自己去写一个iptables防火墙脚本,其实不需要这么做。iptables在rc.modules文件中已有一个非常不错的范本,你只需做一个简单的改进即可使用。

# As a quick example (for a much more extensive treatment, see the IP-Masquerade
# mini-HOWTO) to allow Internet access to a local network 192.168.11.0 with a
# netmask of 255.255.255.0, you'd use these commands in /etc/rc.d/rc.local:
#
#  # EXTERNAL -> external network interface
#  # INTERNAL -> internal network interface
#  EXTERNAL=eth0
#  INTERNAL=eth1
#  echo 1 > /proc/sys/net/ipv4/ip_forward
#  echo "Setting up NAT (Network Address Translation)..."
#  # by default, nothing is forwarded.
#  iptables -P FORWARD DROP
#  # Allow all connections OUT and only related ones IN
#  iptables -A FORWARD -i $EXTERNAL -o $INTERNAL -m state --state ESTABLISHED,RE
LATED -j ACCEPT
#  iptables -A FORWARD -i $INTERNAL -o $EXTERNAL -j ACCEPT
#  # enable MASQUERADING
#  iptables -t nat -A POSTROUTING -o $EXTERNAL -j MASQUERADE

如果还需要一个更加强大的防火墙脚本,可以把以下部分加入到上面的内容中,并把上面的部分删除。

#Our complete stateful firewall script. This firewall can be customized for
#a laptop, workstation, router or even a server.
#这是一个完美的防火墙脚本,它不是一个基于用户顶端的工作组、路由或相等的防火墙

#change this to the name of the interface that provides your "uplink"
#(connection to the Internet)指定网络端口(即是你的设备的位置)

UPLINK="eth1"
#if you're a router (and thus should forward IP packets between interfaces), 如果你有一个静态的路由或IP地址,你需在下面的ROUTER选项使用yse,否则如使DHCP动态分码则用No这一值。
#you want ROUTER="yes"; otherwise, ROUTER="no"

ROUTER="yes"

#change this next line to the static IP of your uplink interface for static SNAT, or
#"dynamic" if you have a dynamic IP. If you don't need any NAT, set NAT to "" to
#disable it.
#以上改变将会在下一次与IP所关联,但必需是一个不受冲突的地址、路由,如果你不确定>将会使用动态分址,如果你不知道那NAT最好将NAT字义为“dynamic”。

NAT="192.168.1.1"

#change this next line so it lists all your network interfaces, including lo在下一次上线时它将监听你所有的静态网络,包括lo中断。

INTERFACES="all"

#change this line so that it lists the assigned numbers or symbolic names (from
#/etc/services) of all the services that you'd like to provide to the general
#public. If you don't want any services enabled, set it to ""
#同时在下一次上线时则监听包括动态的/etc/services下的所有服务,如果你不想将所有服务启动于防火墙下,以下选项即给出一个空值"".

SERVICES="http ftp smtp ssh rsync"
if [ "$1" = "start" ] #如果变量值为1,那将启动它。
then
echo "Starting firewall..." #显示一个有效状态
iptables -P INPUT DROP
iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

#enable public access to certain services 允许公众账户激活服务

for x in ${SERVICES}
do
iptables -A INPUT -p tcp --dport ${x} -m state --state NEW -j ACCEPT
done

iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with icmp-port-unreachable

#explicitly disable ECN 中断ECN
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
then
echo 0 > /proc/sys/net/ipv4/tcp_ecn
fi
#disable spoofing on all interfaces 欺骗全部静态
for x in ${INTERFACES}
do
echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
done
if [ "$ROUTER" = "yes" ]
then
#we're a router of some kind, enable IP forwarding 参照主路由相关类型,实现IP传输
echo 1 > /proc/sys/net/ipv4/ip_forward
if [ "$NAT" = "dynamic" ]
then
#dynamic IP address, use masquerading
echo "Enabling masquerading (dynamic ip)..."
iptables -t nat -A POSTROUTING -o ${UPLINK} -j MASQUERADE
elif [ "$NAT" != "" ]
then
#static IP, use SNAT
echo "Enabling SNAT (static ip)..."
iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to ${UPIP}192.168.1.100
fi
fi

elif [ "$1" = "stop" ]
then
echo "Stopping firewall..."
iptables -F INPUT
iptables -P INPUT ACCEPT
#turn off NAT/masquerading, if any
iptables -t nat -F POSTROUTING
fi
APM电源管理:(默认情况下,slackware不会自动关闭电源的解决办法)
依然在rc.modules文件中设置,如下:
#### APM support ###
# APM is a BIOS specification for saving power using several different
# techniques. This is mostly useful for battery powered laptops.
/sbin/modprobe apm将#号去除。
回复 支持 反对

使用道具 举报

发表于 2005-11-29 03:47:06 | 显示全部楼层

X刷新率及辩率设置

前面以经提到,ATI及nVideo显示卡以被内核模块所支持,需要做的只是去更改/etc/xorg.conf文件。以17“CTR显示器为标准设置。

# **********************************************************************
# Monitor section
# **********************************************************************

# Any number of monitor sections may be present

Section "Monitor"

    Identifier  "My Monitor"

# HorizSync is in kHz unless units are specified.
# HorizSync may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.

     HorizSync   30 - 107

#    HorizSync  30-64         # multisync
#    HorizSync  31.5, 35.2    # multiple fixed sync frequencies
#    HorizSync  15-25, 30-50  # multiple ranges of sync frequencies

# VertRefresh is in Hz unless units are specified.
# VertRefresh may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.

     VertRefresh 48-120

EndSection

红色部分设置,是以发挥CTR显卡器最大刷新率支持,三星CTR17”显示器可达到以1024x768分辨率下为85Hz刷新率。

# Any number of graphics device sections may be present

Section "Device"
    Identifier  "VESA Framebuffer"
    Driver      "ati"
    #VideoRam    4096
    # Insert Clocks lines here if appropriate
EndSection

使用ATI显卡设置类型。

# If your card can handle it, a higher default color depth (like 24 or 32)
# is highly recommended.

#   DefaultDepth 8
#   DefaultDepth 16
    DefaultDepth 24
#   DefaultDepth 32

# "1024x768" is also a conservative usable default resolution.  If you
# have a better monitor, feel free to try resolutions such as
# "1152x864", "1280x1024", "1600x1200", and "1800x1400" (or whatever your
# card/monitor can produce)

    Subsection "Display"
        Depth       8
        Modes "1152x864"
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes "1152x864"
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes "1152x864"
    EndSubsection
    Subsection "Display"
        Depth       32
        Modes "1152x864"
EndSubsection

EndSection
实现以24色1152x864的75Hz时钟频率显示效果设置参数定义。(三星17“CTR显示器为例)
回复 支持 反对

使用道具 举报

发表于 2005-11-29 17:16:44 | 显示全部楼层

挂载磁盘系统

挂载磁盘文件系统可以参照一下/etc/fstab文件内容:

/dev/sda2        swap             swap        defaults         0   0
/dev/sda1        /                reiserfs    defaults         1   1
/dev/sda3        /var             reiserfs    defaults         1   2
/dev/sda5        /opt             reiserfs    defaults         1   2
/dev/sda6        /home            reiserfs    defaults         1   2
/dev/sda7        /tmp             reiserfs    defaults         1   2
/dev/sda8        /usr             reiserfs    defaults         1   2
/dev/cdrom      /mnt/cdrom       auto        noauto,user,owner,ro  0   0
/dev/scd0         /mnt/Burn-RW     auto        noauto,user,owner,rw  0   0
/dev/sda0        /mnt/flashdisk   auto        noauto,user,owner,rw  0   0
/dev/fd0          /mnt/floppy      auto        noauto,owner     0   0
devpts             /dev/pts         devpts      gid=5,mode=620   0   0
proc                /proc            proc        defaults         0   0

有人可能发现,本人的文件系统结构当中没有/boot分区。因为这是BSD风格的操作系统,当如果你真需要这么做,那么,在对文件系统分区及格式化的时候,你可能只能使用三个文件系统,(注意slackware是Linux,当然可以用Linux的方式来定义它们)即/boot,swap,和根文件/。否则你将会安装失败,Lilo不能写入MBR的0磁道分区。如果你需要专业一些,把其它的如/var、/opt、/usr、/usr/local等单独分出,则不能使用/boot分区。

如果你有一个外置USB接口的刻录机,哪可以把类似红色部分增加到你的文件中。但不一定是scd之类的,这要看你的系统情况,也许是sr0或sg0或1、2、3等等,后面的rw是可写,而ro只读系统,在些之后,你需要到/mnt目录去建一个文件夹,比如我上面的是Burn-RW,哪就建一个Burn-RW目录,让普通用户可以访问外部设备,需在属性中使用user参数。

自动挂载它们。如果你想自动挂载它们,哪在挂载属性参数中把noauto,改成auto即可实现自动挂载。(哪U盘是否可以自动挂载呢,答案是可以,一样的去做就可以啦),上面蓝色部分是U盘挂载字段。

写入/etc/fstab的作用是提供最大的快捷性,则否你可能需要在以根身分去输入一大串命令去Mounst它们,这样做反而使普通用户很难去访问它们。如果你的本地设置全局变量是GB18030,哪就不需要去增加io=936这样的定义。
回复 支持 反对

使用道具 举报

发表于 2005-11-29 17:59:48 | 显示全部楼层

proftpd的配置与使用

proftpd配置在/etc/proftpd.conf文件中。

# This is a basic ProFTPD configuration file.
# It establishes a single server and a single anonymous login.
# It assumes that you have a user/group "nobody" and "ftp"
# for normal/anonymous operation.

ServerName                      "roFTPD Default Installation"
#ServerType                     standalone
ServerType                      inetd
DefaultServer                   on

# Port 21 is the standard FTP port.
Port                            21 #FTP端口21,默认设置
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                           022 #屏蔽端口

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances                    30 #最大联接数,30是默认设置

# Set the user and group that the server normally runs at.
User                            nobody  #非匿名用户名
Group                         nogroup #非匿名用户组

# This next option is required for NIS or NIS+ to work properly:
#PersistentPasswd off #NIS支持

SystemLog                       /var/log/proftpd.log #日志
TransferLog                     /var/log/xferlog

# Normally, we want files to be overwriteable.
<Directory /*>
  AllowOverwrite                on
</Directory>

# A basic anonymous FTP server configuration.
# To enable this, remove the user ftp from /etc/ftpusers.
<Anonymous ~ftp>
  RequireValidShell             off #允许/屏蔽使用shell命令
  User                          ftp        #匿名用户
  Group                         ftp       #匿名用户组
  # We want clients to be able to login with "anonymous" as well as "ftp"
  UserAlias                     anonymous ftp

  # Limit the maximum number of anonymous logins
  MaxClients                    50       #最大联接数

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin                  welcome.msg #登录信息
  DisplayFirstChdir             .message

  # Limit WRITE everywhere in the anonymous chroot #限止chroot使用
  <Limit WRITE>
    DenyAll
  </Limit>

  # An upload directory that allows storing files but not retrieving
  # or creating directories.
#  <Directory incoming/*>
#    <Limit READ>
#      DenyAll
#    </Limit>
#
#    <Limit STOR>
#      AllowAll
#    </Limit>
#  </Directory>

</Anonymous>
回复 支持 反对

使用道具 举报

发表于 2005-12-8 11:37:09 | 显示全部楼层

一个tip:用fakeroot打包

大家知道:Slackware打包过程需要root权限(其实几乎所有包管理系统都是如此)。但是我的原则是,以最小权限办事,所以一直考虑是否能不动用root而完成Slackware软件包制作。用过debian的人都知道,Debian的fakeroot就是为此为此目的应运而生的,那么是否可以用在Slackware上,经过试验:答案是肯定的。为了使用fakeroot,需要对一般的Slackbuild稍加改动,最后部分看起来如下:

  1. fakeroot bash<<EOF
  2. chown -R root.root $PKG_DIR
  3. chgrp -R bin sbin {usr/,}{s,}bin usr/{local,X11R6}/bin 2>/dev/null
  4. /sbin/makepkg -l y -c n -p $NAME-$VER-$ARCH-$BUILD$MYIM.tgz
  5. EOF
复制代码


因为fakeroot后如同su一样直接进入一个交互shell,所以只能用here doc了。这样做,既能确保包中文件权限的正确,又能不动用root,万一你打包脚本中不知何故加入了一行rm -rf /,也不至于造成太大损失。

fakeroot的包我就不传上来了,因为我手头有的版本已经老了,当前版本是1.5.5,我现在没条件编译。但对此的使用大家放心,我用这个办法打过上百次软件包,都很好。

fakeroot的源码可以从以下地方下载:
http://packages.debian.org/unstable/utils/fakeroot
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表