Chinaunix首页 | 论坛 | 博客
  • 博客访问: 803266
  • 博文数量: 162
  • 博客积分: 5308
  • 博客等级: 大校
  • 技术积分: 2152
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-15 19:09
个人简介

DevOps让系统管理更轻松。

文章分类

全部博文(162)

文章存档

2014年(28)

2012年(10)

2011年(6)

2009年(60)

2008年(58)

我的朋友

分类: LINUX

2014-02-05 10:49:21


去掉注释
root@d1:~# cat .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.


# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
 umask 022
 export LS_OPTIONS='--color=auto'
 eval "`dircolors`"
 alias ls='ls $LS_OPTIONS'
 alias ll='ls $LS_OPTIONS -l'
 alias l='ls $LS_OPTIONS -lA'


 alias rm='rm -i'
 alias cp='cp -i'
 alias mv='mv -i'
#########################################################################################################
 
 
修改IP:
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.10.18.242 
netmask 255.255.255.0
gateway 10.10.18.1






auto eth1
allow-hotplug eth1
iface eth1 inet static
address 10.10.18.243
netmask 255.255.255.0
gateway 10.10.18.1




auto eth2
allow-hotplug eth2
iface eth2 inet static
address 10.10.18.244
netmask 255.255.255.0
gateway 10.10.18.1


#########################################################################################################


配置更新源地址


/etc/apt/sources.list


##添加以下163源:
#####################主要,开源,闭源
deb wheezy main non-free contrib
deb-src wheezy main non-free contrib


###################wheezy-proposed-updates建议更新
deb wheezy-proposed-updates main contrib non-free
deb-src wheezy-proposed-updates main contrib non-free


#wheezy-updates推荐更新
deb wheezy-updates main contrib non-free
deb-src wheezy-updates main contrib non-free




#wheezy/updates安全更新
deb -security wheezy/updates main contrib non-free 
deb-src -security wheezy/updates main contrib non-free 


deb wheezy main contrib non-free
deb http://security.debian.org wheezy/updates main contrib non-free


保存


然后进行更新源
apt-get -s upgrade
apt-get update
需要等一会


apt-get install sysv-rc-conf






临时下载存放包的路径:
/var/cache/apt/archives


清理下载的包:
执行apt-get clean
以后最好用dselect install升级
会提示你是否删除下载的*.deb的包
#########################################################################################################
开发环境:


DEBIN/UBUNTU系统环境下的依耐关系


apt-get install -y build-essential lrzsz tcpdump unzip tree valgrind ca-certificates openssl gcc g++ gdb make autoconf automake libboost-dev libboost-doc libxml2  manpages-dev glibc-doc autotools-dev libtool libncurses-dev xsltproc groff-base libpcre3 libpcre3-dev zlib1g-dev libssl-dev libwbxml2-dev bzip2 zlibc libpcre++-dev libpcrecpp0 libxslt1-dev libedit* ncurses*










#########################################################################################################


Debian修改inittab不启动图形界面问题及解决


root@d1:~# apt-get install sysv-rc-conf
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  libcurses-perl libcurses-ui-perl libterm-readkey-perl
下列【新】软件包将被安装:
  libcurses-perl libcurses-ui-perl libterm-readkey-perl sysv-rc-conf
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 43 个软件包未被升级。
需要下载 414 kB 的软件包。
解压缩后会消耗掉 1,355 kB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 / wheezy/main libcurses-perl amd64 1.28-1+b2 [116 kB]
获取:2 / wheezy/main libterm-readkey-perl amd64 2.30-4+b2 [32.2 kB]
获取:3 / wheezy/main libcurses-ui-perl all 0.9609-1 [241 kB]
获取:4 / wheezy/main sysv-rc-conf all 0.99-7 [24.2 kB]
下载 414 kB,耗时 2秒 (155 kB/s)   
Selecting previously unselected package libcurses-perl.
(正在读取数据库 ... 系统当前共安装有 134699 个文件和目录。)
正在解压缩 libcurses-perl (从 .../libcurses-perl_1.28-1+b2_amd64.deb) ...
Selecting previously unselected package libterm-readkey-perl.
正在解压缩 libterm-readkey-perl (从 .../libterm-readkey-perl_2.30-4+b2_amd64.deb) ...
Selecting previously unselected package libcurses-ui-perl.
正在解压缩 libcurses-ui-perl (从 .../libcurses-ui-perl_0.9609-1_all.deb) ...
Selecting previously unselected package sysv-rc-conf.
正在解压缩 sysv-rc-conf (从 .../sysv-rc-conf_0.99-7_all.deb) ...
正在处理用于 man-db 的触发器...
正在设置 libcurses-perl (1.28-1+b2) ...
正在设置 libterm-readkey-perl (2.30-4+b2) ...
正在设置 libcurses-ui-perl (0.9609-1) ...
正在设置 sysv-rc-conf (0.99-7) ...




#########################################################################################################
软件包管理:




确定软件包是否安装
root@d1:~# dpkg -l zsh
dpkg-query: no packages found matching zsh




查看软件系统所有包
dpkg -l




安装软件包
dpkg -i zsh
apt-get install zsh


搜索软件包
apt-cache search zsh 


列出软件包相关的文件
dpkg -L zsh


卸载软件包
apt-get remove zsh


dpkg -r zsh
remove 只是删掉数据和可执行文件
 
dpkg -P zsh
完全清除一个已安装的包裹.和 remove 不同的是, remove 只是删掉数据和可执行文件, purge 另外还删除所有的配制文件.




dpkg -s bash
显示已安装包裹的信息.同时请看 apt-cache 显示 Debian 存档中的包裹信息,以及 dpkg -I 来显示从一个.deb 文件中提取的包裹信息.


#########################################################################################################
服务管理


服务配置管理器
sysv-rc-conf


查看所有服务
service --status-all


相比较RH系列的ntsysv,Debian也有个类似的服务管理软件rcconf
 apt-get install rcconf
 
 
重新启动服务
/etc/init.d/ssh restart 




编辑脚本于/etc/init.d 并赋予可执行权限
‘S’:代表随系统启动 ‘K’代表随系统停止




RedHat包含了一些用于自动管理SysV初始脚本过程的工具 是chkconfig与service。
debian并没有包含这些工具,但是却提供相似的管理工具


debian 的update-rc.d与RedHat的chkconfig工具相类似。然而chkconfig是一个二进制程序,而update-rc.d是一个 Perl脚本




例如,命令chkconfig -level 2345 inetd off的作用相同:
$ update-rc.d -f inetd remove
$ update-rc.d inetd start 20 2 3 4 5 . stop 20 0 1 6




例如:
update-rc.d script-name start 90 1 2 3 4 5 . stop 52 0 6 .
start 90 1 2 3 4 5 . : 表示在1、2、3、4、5这五个运行级别中,按先后顺序,由小到大,第90个开始运行这个脚本。


stop 52 0 6 . :表示在0、6这两个运行级别中,按照先后顺序,由小到大,第52个停止这个脚本的运行。


使脚本开机自动执行:update-rc.d apache2 defaults 99
添加启动项,例如mysql
hto@debian:/etc/rc2.d$ update-rc.d mysql defaults 
update-rc.d: warning: /etc/init.d/mysql missing LSB information
update-rc.d: see <
Adding system startup for /etc/init.d/mysql ...
/etc/rc0.d/K20mysql -> ../init.d/mysql
/etc/rc1.d/K20mysql -> ../init.d/mysql
/etc/rc6.d/K20mysql -> ../init.d/mysql
/etc/rc2.d/S20mysql -> ../init.d/mysql
/etc/rc3.d/S20mysql -> ../init.d/mysql
/etc/rc4.d/S20mysql -> ../init.d/mysql
/etc/rc5.d/S20mysql -> ../init.d/mysql


删除启动项
hto@debian:/etc/rc2.d$ update-rc.d -f mysql remove 
Removing any system startup links for /etc/init.d/mysql ...
/etc/rc0.d/K20mysql
/etc/rc1.d/K20mysql
/etc/rc2.d/S20mysql
/etc/rc3.d/S20mysql
/etc/rc4.d/S20mysql
/etc/rc5.d/S20mysql
/etc/rc6.d/K20mysql






invoke-rc.d控制相关服务
debian下与RedHat的service命令作用等同的命令为invoke-rc.d
例:
service inetd start与invoke-rc.d inetd start
停止服务的命令为invoke-rc.d inetd stop
 invoke-rc.d vsftpd restart
 
 
/etc/inittab
1) debian的默认运行级别是2。
2) debian并不会在/etc/inittab文件中中配置X Window系统显示管理器。
3) 运行级别2与3是相同的,而运行级别4与5是相同的。
4) 运行级别4与5只会运行一个虚拟终端,而运行级别2与3却会运行6个。




#########################################################################################################


系统版本提示信息文件:
/etc/motd
/etc/issue


#########################################################################################################
基本开发环境配置


 1.安装系统
别的没什么说的,就是安的时候把网线拔了,不然到configure apt的时候会卡起很久不走的


2.配置网络
编辑/etc/network/interface
auto eth0
iface inet eth0 static  #设置静态IP地址
address 192.168.1.235
netmask 255.255.255.0 
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
如果是要设置为自动获取ip地址就应该为
auto eth0
iface eth0 inet dhcp
保存,退出,重启网络
$/etc/init.d/networking restart
此时已经可以ping通局域网地址,但外网仍不行
Debian和Ubuntu一样,设置nameserver是在/etc/resolv.conf 里面,在其中添加一行:
nameserver 192.168.1.1


3.配置apt源
vim /etc/apt/source.list 
然后进行更新源
apt-get -s upgrade
apt-get update


4.安装常用软件
apt-get install openssh-server,openssh-client
apt-get install lrzsz
apt-get install tcpdump
apt-get install unzip 
apt-get install tree 
apt-get install valgrind
apt-get install more
apt-get install openssl ca-certificates openssl-doc
apt-get install mysqlserver,mysqlclient


5.配置vim + ctags + taglist 
apt-get install vim
apt-get install ctags
在vim的主网站下载插件taglist

然后上传进行解压
unzip taglist.zip -d ~/.vim解开;
:helptags ~/.vim/doc安装文档。 
如果要配置的更详细,这个不错
http://blog.csdn.net/wooin/archive/2007/10/31/1858917.aspx


6.安装gcc
apt-get install gcc
apt-get install g++
apt-get install gdb
apt-get install make
apt-get install autoconf
apt-get install automake
apt-get install libboost-dev
apt-get install libboost-doc
apt-get install libxml2
apt-get install libmysqlclient15-dev
apt-get install manpages-dev
apt-get install glibc-doc


7.安装Python
我使用的是Debian4.0的r4版本,默认安装的是2.4的Python,需要更新
apt-get install python2.5 
apt-get install python-docutils 
apt-get install python2.5-dbg 
apt-get install python2.5-dev 
apt-get install python2.5-examples
8.安装twisted
apt-get install python-twisted-bin
apt-get install python-twisted-runner
安装完后,进入Python交互环境中,输入
>>>import twisted.internet
结果报告说无法载入该模块,我晕死。小郭在安装的时候是是先安装Zope interface,
下载地址

,下载zope.interface-3.3.0.tar.gz
安装:
$python setup.py build
$python setup.py install
没有安装成功,因为需要python2.4 ,而当时他的Ubuntu的Python是2.5。
直接安装twisted也出错,因为没有找到Python.h文件,所以他重新下了Python2.5进行源码安装
我从他那里拷贝来Twisted-8.1.0.tar.bz2(tar -jxvf)解压后安装
>>>import twisted.python






#########################################################################################################
用 apt-get 升级系统
分类: Linux 2011-08-03 09:53 240人阅读 评论(0) 收藏 举报
        针对版本升级:  
  sudo apt-get update
  sudo update-manager -c -d
        然后选选择 upgrade


  
  普通升级:  
  sudo apt-get update
  sudo apt-get upgrade


        针对单一软件升级: 


  sudo apt-get update
  sudo apt-get upgrade package_name_your_want_to_upgrade


        全部升级:


  sudo apt-get dist-upgrade






一、删除缓存
1,非常有用的清理命令:
sudo apt-get autoclean                清理旧版本的软件缓存
sudo apt-get clean                    清理所有软件缓存
sudo apt-get autoremove             删除系统不再使用的孤立软件
这三个命令主要清理升级缓存以及无用包的。
2,清理opera firefox的缓存文件:
ls ~/.opera/cache4
ls ~/.mozilla/firefox/*.default/Cache
3,清理Linux下孤立的包:
终端命令下我们可以用:
sudo apt-get install deborphan -y
4,卸载:tracker
这个东西一般我只要安装ubuntu就会第一删掉tracker 他不仅会产生大量的cache文件而且还会影响开机速度。所以在新得利里面删掉就行。
附录:
包管理的临时文件目录:
包在
/var/cache/apt/archives
没有下载完的在
/var/cache/apt/archives/partial
二、删除软件
ubuntu软件的删除一般用“ubuntu软件中心”或“新立得”就能搞定,但有时用命令似乎更快更好~~
sudo apt-get remove --purge 软件名
sudo apt-get autoremove                                                        删除系统不再使用的孤立软件
sudo apt-get autoclean                                                            清理旧版本的软件缓存
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P              清除残余的配置文件
保证干净。


#########################################################################################################
#########################################################################################################
#########################################################################################################
#########################################################################################################
#########################################################################################################
#########################################################################################################




























































































阅读(3155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~