第一节
1.安装ssh
apt-get install ssh openssh-server
1.安装ssh
apt-get install ssh openssh-server
网卡设置 /etc/network/interfaces
将allow-hotplug eth0 设置为auto eth0
nano /etc/network/interfaces
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.0.0
broadcast 192.168.255.255
gateway 192.168.0.1
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.0.0
broadcast 192.168.255.255
gateway 192.168.0.1
重启网络
/etc/init.d/networking restart
/etc/init.d/networking restart
编辑/etc/hosts
nano /etc/hosts
nano /etc/hosts
127.0.0.1 localhost localdomian localhost
然后输入:
echo ls.ls.com>/etc/hostname
echo ls.ls.com>/etc/hostname
重启系统
shutdown -r now
shutdown -r now
hostname
hostname -f
ssh成功
hostname -f
ssh成功
----------------------------
更新系统
更新系统
编辑/etc/apt/sources.list文件,命令如下:
nano /etc/apt/sources.lis
加入如下源:
deb http://ftp2.de.debian.org/debian/etch main
deb-src http://ftp2.de.debian.org/debian/ etch main
nano /etc/apt/sources.lis
加入如下源:
deb http://ftp2.de.debian.org/debian/etch main
deb-src http://ftp2.de.debian.org/debian/ etch main
然后输入:
apt-get update
更新apt封装数据库,命令如下:
apt-get upgrade
然后会安装更新的数据包
apt-get update
更新apt封装数据库,命令如下:
apt-get upgrade
然后会安装更新的数据包
第二节DNS服务器的设置
1.补充内容
2.配置bind的dns服务器
DNS三种类型1.缓存域名服务器2.主域名服务器3.辅域名服务器
apt-get install bind9
apt-get isntall dnsutils
apt-get isntall bind9-host
apt-get isntall bind9-host
/etc/bind/named.conf
首先 DNS指向自己
nano /etc/resolv.conf
search ls.ls.com
nameserver 192.168.0.2
nameserver 192.168.0.2
修改/etc/bind/named.conf.options文件中提供对域名
正向解析和IP的反向解析
正向解析和IP的反向解析
named.conf.options是named.conf的包含文件
nano /etc/bind/named.conf.options
配置内容如下:
options {
directory "/var/cache/bind";
allow-query { any; };
};
directory "/var/cache/bind";
allow-query { any; };
};
zone "example.com" {
type master;
file "foxitsoftware.com.db";
};
type master;
file "foxitsoftware.com.db";
};
配置正向解析文件/var/cache/bind/ds.ls
cp /etc/bind/db.local /var/cache/bind/db.ls
//var/cache/bind#
vim example.com.db
$TTL 604800
@ IN SOA @ ns01.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
@ IN SOA @ ns01.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
NS @
$ORIGIN example.com.
example.com IN MX 10 mail.example.com.
www IN A 192.168.2.222
mail IN A 192.168.2.222
rt IN A 192.168.2.222
$ORIGIN example.com.
example.com IN MX 10 mail.example.com.
www IN A 192.168.2.222
mail IN A 192.168.2.222
rt IN A 192.168.2.222
重新启动
/usr/sbin/rndc reload
重新配置
/uer/sbin/rndc reconfig
语法检查:
named-checkconf named.conf.option
/uer/sbin/rndc reconfig
语法检查:
named-checkconf named.conf.option
测试
host nslookup
host nslookup
host ls.ls.com
host IP 反向解析
host IP 反向解析
第三节配置apache
安装
apt-get install apache2
安装
apt-get install apache2
安装elinks
apt-get install elinks
apache2.conf配置文件
对配置文件进行分割,利于管理
/etc/apache2/sites-available/default
对配置文件进行分割,利于管理
/etc/apache2/sites-available/default
端口ports.conf
conf.d编码
conf.d编码
nano /etc/apache2/sites-available/default
DocumentRoot /var/www/lssite
注销这行 RedirectMatch ^/$ /apache2-default/
Errorlog /var/log/apache2/ls_error.log
删除默认的网页在apache2-default
mkdir /var/www/lssite
cd lssite
echo "it work">index.html
mkdir /var/www/lssite
cd lssite
echo "it work">index.html
ls -l查看权限 index.html 能否访问
重启
/etc/init.d/apache2 restart
/etc/init.d/apache2 restart
cd /home
cd ls
mkdir public_html
cd public_html
nano index.html
cd /
a2enmod userdir
/etc/init.d/apache2 force-reload
a2enmod userdir
/etc/init.d/apache2 force-reload
mail:/etc/apache2/sites-available# ls
default default-ssl vhost_rt wwwmydebian
NameVirtualHost *
ServerAdmin webmaster@localhost
ServerName www.mysite.com
DocumentRoot /var/www/mysite
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog /var/log/apache2/mysite_error.log
LogLevel warn
CustomLog /var/log/apache2/mysite_access.log combined
ServerSignature On
ServerAdmin webmaster@localhost
ServerName www.mysite.com
DocumentRoot /var/www/mysite
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog /var/log/apache2/mysite_error.log
LogLevel warn
CustomLog /var/log/apache2/mysite_access.log combined
ServerSignature On
mail:/etc/apache2/sites-available# vim vhost_rt
ServerAdmin root@localhost
DocumentRoot /var/www/example_com/rt/htdocs
ServerName www.rt.com
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ErrorLog /var/log/apache2/www_rt_com_error.log
LogLevel warn
CustomLog /var/log/apache2/www_rt_com_access.log combined
ServerSignature On
mysql安装
1.数据库目录
/var/lib/mysql/
2.配置目录
/etc/mysql
3.命令文件
/usr/share/mysql(mysql.server命令及配置文件)
4.启动脚本
/etc/init.d/mysql(启动脚本文件mysql的目录)
1.数据库目录
/var/lib/mysql/
2.配置目录
/etc/mysql
3.命令文件
/usr/share/mysql(mysql.server命令及配置文件)
4.启动脚本
/etc/init.d/mysql(启动脚本文件mysql的目录)
修改mysql密码
1.命令
#mysqladmin -u root password 'new-password'
mysqladmin -u用户名 -p旧密码 password新密码
2.
mysqladmin -u root password 123
1.命令
#mysqladmin -u root password 'new-password'
mysqladmin -u用户名 -p旧密码 password新密码
2.
mysqladmin -u root password 123
create database+库名;
例如创建一个名字为ls的库
create database ls;
use ls;
create table sl;
create table sl(name varchar(20),sex varchar(20),birth date,
);
);
describe sl;
insert into sl values('ls','man','1978-8-8');
select * from sl;
select * from sl;
--------------------
samba
apt-get install samba
samba
apt-get install samba
/etc/samba/smb.conf
配置共享目录
[global]
log file=/var/log/samba/log.%m
[WOW]
comment=tem file
path=/WOW
read only=no
public=yes
重启/etc/init.d/samba restart
配置共享目录
[global]
log file=/var/log/samba/log.%m
[WOW]
comment=tem file
path=/WOW
read only=no
public=yes
重启/etc/init.d/samba restart
创建用户
touch /etc/samba/smbpasswd
smbpasswd -a 用户名(ls)
Debian 参考手册
http://www.linuxforum.net/forum/ubbthreads.php
http://docs.huihoo.com/debian/debian-study.html#id2861730
http://www.cmuch.com/p_w_uploads/month_0603/reference.zh-cn.html
http://www.cmuch.com/article.asp?id=51
在debian下安装local的问题要解决这个问题,其实很简单,只要执行下面几条命令,一切都会OK:
debian:~# apt-get install locales
debian:~# dpkg-reconfigure locales
debian:~# locale
debian:~# apt-get install locales
debian:~# dpkg-reconfigure locales
debian:~# locale