home-server
操作系统版本:Slackware 12.1
1 硬件
配置1块网卡,映射到/dev/vmnet2。
2 安装基础系统
只安装a/目录下的软件包,采用expert模式,全部安装。
配置lilo,安装在MBR中。
3 安装库文件
- l/zlib-1.2.3-i486-2
- l/apr-1.2.12-i486-1(httpd use)
- l/apr-util-1.2.12-i486-1(httpd use)
4 安装基本网络包
- n/iptables-1.4.0-i486-1
- n/iputils-s20070202-i486-2
- n/mailx-12.3-i486-1
- n/net-tools-1.60-i486-2
- n/netkit-ftp-0.17-i486-1
- n/network-scripts-12.1-noarch-1
- n/openssh-5.0p1-i486-1
- n/openssl-0.9.8g-i486-1
- n/tcpdump-3.9.8-i486-1
5 安装nfs包
- n/nfs-utils-1.1.2-i486-1
- n/portmap-6.0-i486-1
6 安装网络服务器
- n/vsftpd-2.0.5-i486-1
- n/httpd-2.2.8-i486-1
- n/inetd-1.79s-i486-8
- n/samba-3.0.28a-i486-1
- n/openldap-client-2.3.38-i486-1(samba/httpd use)
- n/cyrus-sasl-2.1.22-i486-1(samba/httpd use)
- n/tcp_wrappers-7.6-i486-1
7 配置网络
执行netconfig配置网络:
# netconfig
IP地址:10.10.20.20/24
8 安装补丁
使用nfs从develop获取更新包:
# mount -t nfs -o nolock 10.10.20.240:/newpkg /mnt # cd /mnt/packages # upgradepkg *.tgz # umount /mnt
9 防火墙配置
有关各个iptables脚本的详细内容见:Iptables脚本。
这里使用服务器脚本rc.iptables-server.ref,使用nfs从develop获取:
# mount -t nfs -o nolock 10.10.20.240:/newpkg /mnt # cd /etc/rc.d # cp /newpkg/rc.iptables-server.ref rc.iptables # chmod a+x rc.iptables
修改/etc/rc.d/rc.S文件,把/newpkg/rc.S.ref模板内容粘贴到rc.S的末尾。
# umount /mnt
修改/etc/rc.d/rc.iptables脚本,去掉相关注释,使得:
- 提供服务:ping、ssh。
10 设置内核参数
有关脚本的详细内容见:Sysctl脚本。
# mount -t nfs -o nolock 10.10.20.240:/newpkg /mnt # cd /etc/rc.d # cp /newpkg/rc.sysctl.ref rc.sysctl # chmod a+x rc.sysctl
编辑/etc/rc.d/rc.M,把/newpkg/rc.M.ref模板内容粘贴到rc.inet2的前面。
# umount /mnt
11 配置httpd
启动apache:
# chmod a+x /etc/rc.d/rc.httpd
启用mod_ssl,编辑/etc/httpd/httpd.conf,取消如下注释:
#LoadModule ssl_module lib/httpd/modules/mod_ssl.so #include /etc/httpd/extra/httpd-ssl.conf
生成测试用的证书:
# cd /etc/httpd/ # openssl req -new -x509 -nodes -out server.crt -keyout server.key
修改/etc/rc.d/rc.iptables脚本,去掉相关注释,使得:
- 提供服务:http(s)。
12 配置vsftpd
编辑/etc/inetd.conf, 打开vsftp,同时关闭其他打开的服务。
修改/etc/rc.d/rc.iptables脚本,去掉相关注释,使得:
- 提供服务:ftp。
12 配置samba
建立/etc/samba/smd.conf配置文件,可以拷贝同目录下的smb.conf-sample。
这里只配置一个最简单的例子。修改如下配置:
... security = share ... [public] comment = Public Stuff path = /newpkg public = yes writable = yes printable = no write list = @staff ...
启动samba:
# cd /etc/rc.d # chmod a+x rc.samba
修改/etc/rc.d/rc.iptables脚本,增加:
# samba iptables -A INPUT -p tcp --dport netbios-ns -m state \ --state NEW -j ACCEPT iptables -A INPUT -p udp --dport netbios-ns -m state \ --state NEW -j ACCEPT iptables -A INPUT -p tcp --dport netbios-dgm -m state \ --state NEW -j ACCEPT iptables -A INPUT -p udp --dport netbios-dgm -m state \ --state NEW -j ACCEPT iptables -A INPUT -p tcp --dport netbios-ssn -m state \ --state NEW -j ACCEPT iptables -A INPUT -p udp --dport netbios-ssn -m state \ --state NEW -j ACCEPT iptables -A INPUT -p tcp --dport microsoft-ds -m state \ --state NEW -j ACCEPT iptables -A INPUT -p udp --dport microsoft-ds -m state \ --state NEW -j ACCEPT