ImageVerifierCode 换一换
格式:DOC , 页数:36 ,大小:309KB ,
资源ID:7172033      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/7172033.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(Linux常用配置方法及重要命令.doc)为本站上传会员【仙人****88】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

Linux常用配置方法及重要命令.doc

1、 一、 Fedora系统配置 1. 【设置网卡IP】 步骤如下: 1) 用root用户登陆,打开/etc/sysconfig/network-scripts/ifcfg-eth0文件 注意:打开的文件要根据网卡来设置,如:网卡eth1的配置文件就是ifcfg-eth1。 2) 设置以下内容: DEVICE=eth0 BOOTPROTO=static IPADDR=10.128.32.36 NETMASK=255.0.0.0 ONBOOT=yes GATEWAY=10.128.32.102 说明:网卡GATEWAY不一定要设置在这个网卡配置文件中,也可以配置到/etc/

2、sysconfig/network文件中,如下所示: NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=localhost.localdomain GATEWAY=10.128.32.102 3) 重启network服务 [root@localhost:/etc/sysconfig]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface:

3、 [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: [ OK ] 2. 【启动telnet服务】 telnet服务是由xinetd(扩展的网络守护进程服务程序)守护的,所以很多配置都是在xinetd下进行。具体步骤如下: 1) 检测telnet、telnet-server的rpm包是否安装 [root@localh

4、ost:/etc/sysconfig]# rpm -qa | grep telnet telnet-0.17-37 telnet-server-0.17-37 主要看telnet-server有没有安装,如果没有要先把telnet-server安装起来(具体安装方法略)。 2) 修改telnet服务配置文件 Fedora默认是不开通telnet服务的,所以需要手动配置开启: [root@localhost:/etc/sysconfig]# vi /etc/xinetd.d/telnet service telnet { flags = RE

5、USE socket_type = stream wait = no user = root server = /usr/sbin/in.telnetd log_on_failure += USERID disable = yes } 将disable项屏蔽或者改为no: disable = no 3) 修改Fedora下另一个telnet配置文件 对于Red

6、Hat系统,修改到telnet文件就可以了,但是Fedora对权限的管理比Red-Hat严格,还需要修改同一个目录下的krb5-telnet,不然客户端会鉴权不通过而无法连接。 [root@localhost:/etc/xinetd.d]# ls *telnet* ekrb5-telnet krb5-telnet telnet [root@localhost:/etc/xinetd.d]# vi krb5-telnet service telnet { flags = REUSE socket_type = str

7、eam wait = no user = root server = /usr/kerberos/sbin/telnetd log_on_failure += USERID disable = no } 将disable项屏蔽或者改为no: disable = no 注意:在权限和鉴权方面,Fedora和Red-Hat一样,都要让防火墙允许telnet连接。一般,可以直接关闭防火墙,否则

8、就必须用setup工具配置一下。 4) 重新启动xinetd守护进程 [root@localhost:/etc/xinetd.d]# service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] 3. 【启动FTP服务】 FTP守护进程是vsftpd,开启步骤如下: 1) 检测ftp、lftp的rpm包是否安装 [root

9、@localhost:/etc/xinetd.d]# rpm -qa | grep ftp gftp-2.0.18-3.2.2 lftp-3.5.1-2.fc6 vsftpd-2.0.5-8 tftp-server-0.42-3.1 ftp-0.17-33.fc6 tftp-0.42-3.1 2) 配置开启ftp服务 运行setup,在system service中选中vsftpd按空格选中,然后quit。 3) 关闭SeLinux的安全设置 和Red-Hat不同,Fedora存在一个SELinux的安全机制管理,需要撤销SELinux对ftp的安全设置,FTP才能正常

10、登陆,不然会报“500 OOPS: cannot change directory”的错误。执行下面的语句即可: [root@localhost:/etc/xinetd.d]# setsebool ftpd_disable_trans 1 注意:一旦重启该命令就会失效,所以最好的办法是在X界面下,点击菜单“System”à“Administration”à“Security Level and Firewall”,将选项SELinux设置为“Disable”,然后重启系统,就可以保持这个设置了。 4)重启FTP服务 [root@localhost:/etc/xinetd.d]# ser

11、vice vsftpd restart Shutting down vsftpd: [ OK ] Starting vsftpd for vsftpd: [ OK ] 4. 【设置开机自动执行】 设置方法如下: 1)用root用户登陆 2)vi /etc/rc.local 3)添加要开机执行的语句,如果是一个脚本文件,注意要绝对路径 #!/bin/sh # # This script will be executed *afte

12、r* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local setsebool ftpd_disable_trans 1 service vsftpd restart 5. 【设置自动关机】 自动关机可以在crontab中设置。假设希望每天23::50关机,设置方法如下: 1)用root登

13、陆 2)vi /etc/crontab 3)在文件最后添加以下语句: 50 23 * * * root shutdown -h now 6. 【设置允许root登陆telnet】 设置方法如下: 1)用root登陆 2)vi /etc/pam.d/login 3)注释该文件第一行内容:   #%PAM-1.0     #auth               required           /lib/security/pam_securetty.so     auth               required           /lib/security

14、/pam_stack.so   service=system-auth     auth               required           /lib/security/pam_nologin.so     account         required           /lib/security/pam_stack.so   service=system-auth     password       required           /lib/security/pam_stack.so   service=system-auth     sessio

15、n         required           /lib/security/pam_stack.so   service=system-auth     session         optional           /lib/security/pam_console.so   7. 【设置允许root登陆ftp】 普通方式下,如果/etc/vsftpd/vsftpd.conf文件中有如下内容: userlist_enable=YES userlist_file=/etc/vsftpd.user_list pam_service_name=vsftpd 只需

16、在/etc/vsftpd/user_list和/etc/vsftpd/ftpuser文件中删除root即可做到root用户ftp登陆。 具体方法如下: 1)用root登陆 2)vi /etc/vsftpd/user_list,注释root: # vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a pass

17、word. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. #root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody 3)vi /etc/vsftpd/ftpusers,注释root: # Users that are not allowed to login via ftp #root bin

18、 daemon adm lp sync shutdown halt mail news uucp operator games nobody 8. 【设置提示符】 Bash下具体设置方法如下: 1)用户登陆 2)vi .profile或者vi .bashrc 3)添加如下语句(该设置的效果是“[用户名@主机名:路径名]#”): export PS1="[\u@\h:\w]# " (注意,如果对所有用户设定,以上语句追加到/etc/profile。) 4)重新登陆,登陆显示为: [chyy@localhost:~/Documents/ftp资料]#

19、 顺便提一下,在CSH或TCSH下,应该修改.cshrc或.tcshrc文件,修改语句是: set prompt="[`whoami`@`hostname`:`pwd`]# " 9. 【设置默认语言】 设置方法如下: 1)用root用户登陆 2)vi /etc/sysconfig/i18n 该文件内容是: LANG="zh_CN.UTF-8" SYSFONT="latarcyrheb-sun16" SUPPORTED="zh_CN.UTF-8:zh_CN:zh" 3)修改为: LANG="en_US.UTF-8" SUPPORTED="en_US.UTF-8:en_

20、US:en" SYSFONT="latarcyrheb-sun16" 10. 【设置默认启动系统】 设置方法如下: 1)用root用户登陆 2)cp /boot/grub/menu.lst /boot/grub/menu.lst.bak 3)vi /boot/grub/menu.lst 4)从0开始数title,那个title下的操作系统是默认,就将default设置为该title对应的序数 示例,以下内容中,如果default为0,代表默认从Fedora启动;为1,代表从Windows启动: #boot=/dev/hda default=0 timeout=5 s

21、plashimage=(hd0,6)/boot/grub/splash.xpm.gz hiddenmenu title Fedora Core (2.6.18-1.2798.fc6xen)         root (hd0,6)         kernel /boot/xen.gz-2.6.18-1.2798.fc6         module /boot/vmlinuz-2.6.18-1.2798.fc6xen ro root=LABEL=/1 rhgb quiet         module /boot/initrd-2.6.18-1.2798.fc6xen.img

22、title Dos         rootnoverify (hd0,0)         chainloader +1 11. 【设置Telnet下的Vim颜色】 设置方法如下: 1)用户登陆 2)cp /usr/share/vim/vim70/vimrc_example.vim .vimrc 3)vi .vimrc,添加如下蓝色语句(最好手动敲入,^[的输入方式是Ctrl-v然后输入Esc) if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif " added by chyy

23、 if !has("gui_running") syntax on set t_Co=8 set t_Sf=^[[3%p1%dm set t_Sb=^[[4%p1%dm colorscheme desert endif 4)在SecureCRT的模拟终端类型选择ANSI,并钩上ANSI Color 5)如果需要更换颜色设置,更改colorscheme一句即可,例如: colorscheme default 小窍门:如果不清楚有哪些颜色选项的话,可以用vi打开一个.c文件,键入”: colorscheme“,键入空格,然后敲TAB按钮,vi会自动切换各种

24、颜色选项的名称。 6)注意,某些vimrc_example.vim文件中有个bug: " In an xterm the mouse should work quite well, thus enable it. set mouse=a 在非xterm环境(如Telnet)下,该句会导致vi无法正常运行,建议修改如下: " In an xterm the mouse should work quite well, thus enable it. if has("gui_running") set mouse=a endif 12. 【启动samba服务】 设置方法如

25、下: 1)启动smb服务 service smb start 2)开启suseLinux权限 setsebool -P samba_enable_home_dirs on 注意:如果想开机自动启动smb服务,将上述两句命令加入/etc/rc.d/rc.local即可。 二、 Linux常用系统命令 1. 【crontab定时任务设置】 Crontab文件放在/etc/下,其内容一般是: [root@localhost:/etc]# cat crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin M

26、AILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly 格式说明如下: 第一道第五个字段的整数取值范围及意义是: 0~59 表示分 1~23 表示小时 1~31 表示日 1~12 表示月份 0~6 表示星期(其中0表示星期

27、日) 2. 【shutdown关机】 用man查询命令: [root@localhost:/etc]# man shutdown SHUTDOWN(8) Linux System Administrator鈥檚 Manual SHUTDOWN(8) NAME shutdown - bring the system down SYNOPSIS /sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message] DESCRIPTION

28、 shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login(1) is blocked. It is possible to shut the system down immediately or after a specified delay. All processes are first notified that the system is going down by th

29、e signal SIGTERM. This gives programs like vi(1) the time to save the file being edited, mail and news pro-cessing programs a chance to exit cleanly, etc. shutdown does its job by signalling the init pro- cess, asking it to change the runlevel. Runlevel 0 is used to halt the system, runlevel

30、 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown. To see which actions are taken on halt or reboot see the appropriate entries for these ru

31、nlevels in the file /etc/inittab. OPTIONS -a Use /etc/shutdown.allow. -t sec Tell init(8) to wait sec seconds between sending processes the warning and the kill signal, before changing to another runlevel. -k Don鈥檛 really shutdown; only send the warning mess

32、ages to everybody. -r Reboot after shutdown. -h Halt or poweroff after shutdown. -H Halt action is to halt or drop into boot monitor on systems that support it. -P Halt action is to turn off the power. -n [DEPRECATED] Don鈥檛 call

33、init(8) to do the shutdown but do it ourself. The use of this option is discouraged, and its results are not always what you鈥檇 expect. -f Skip fsck on reboot. -F Force fsck on reboot. -c Cancel an already running shutdown. With this option it is of course n

34、ot possible to give the time argument, but you can enter a explanatory message on the command line that will be sent to all users. time When to shutdown. warning-message Message to send to all users. The time argument can have different formats. Fir

35、st, it can be an absolute time in the format hh:mm, in which hh is the hour (1 or 2 digits) and mm is the minute of the hour (in two digits). Second, it can be in the format +m, in which m is the number of minutes to wait. The word now is an alias for +0. 命令示例: shutdown -h now 立即关

36、机 shutdown -h 50 50分钟后关机 shutdown –t 54000 15小时后自动关机 3. 【rpm软件安装卸载工具】 1) 查询rpm软件包: rpm -qa | grep xxx 2) 安装rpm软件包: rpm -ivh xxx.rpm 3) 卸载rpm软件包: rpm -e xxx 4) 修复rpm库(执行以前先备份/var/lib/rpm目录): rpm --rebuilddb 4. 【mount挂载磁盘】 1)挂载u盘: mount -t vfat /dev/sda1 /mnt/u

37、 2)挂载Windows磁盘: mount -t vfat /dev/hda1 /mnt/c -o iocharset=cp936, codepage=936 3)挂载iso系统: mount /mnt/e/linux/fc6.iso /root/iso/ -o loop 4)挂载光盘: mount /dev/cdrom -t iso9660 /media/cdrom 4)挂载远程Windows共享目录: mount -t cifs -o username=administrator,password=123456 192.168.1.20:Download /mnt/share

38、 其中administrator和123456分别是用户名和密码,192.168.1.20是Win IP,Download是共享目录,/mnt/share是挂载目录(必须首先创建好) 5. 【date查询和设置系统时间】 用man查询命令: NAME date - print or set the system date and time SYNOPSIS date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] DESCRIPT

39、ION Display the current time in the given FORMAT, or set the system date. -d, --date=STRING display time described by STRING, not 鈥榥ow鈥? -f, --file=DATEFILE like --date once for each line of DATEFILE -s, --set=STRING set ti

40、me described by STRING -u, --utc, --universal print or set Coordinated Universal Time 示例一,查询系统时间: [chenyaya:~]# date Mon Feb 1 11:52:33 CST 2010 示例二,设置系统时间: [chenyaya:~]# date -s 12:31:00 Mon Feb 1 12:31:00 CST 2010 示例二,设置系统时间: [chenyaya:~]# date -u 0201123110 Mon F

41、eb 1 12:31:00 UTC 2010 [chenyaya:~]# date Mon Feb 1 20:31:00 CST 2010 6. 【groupadd增加用户组】 语法结构是: groupadd [-g gid] group  说明:  g 制定组的ID号  gid 组的ID号(不能与现有的组ID号重复)  group 组名  示例: #groupadd –g 100 sun 7. 【netstat查询网络端口】 语法结构是: [root@localhost ~]# netstat --help usage: netstat [-

42、veenNcCF] [] -r netstat {-V|--version|-h|--help} netstat [-vnNcaeol] [ ...] netstat { [-veenNac] -I[] | [-veenNac] -i | [-cnNe] -M | -s } [delay] -r, --route display routing table -I, --interfaces= display interfa

43、ce table for -i, --interfaces display interface table -g, --groups display multicast group memberships -s, --statistics display networking statistics (like SNMP) -M, --masquerade display masqueraded connections

44、 -v, --verbose be verbose -n, --numeric don't resolve names --numeric-hosts don't resolve host names --numeric-ports don't resolve port names --numeric-users don't resolve user names -N,

45、symbolic resolve hardware names -e, --extend display other/more information -p, --programs display PID/Program name for sockets -c, --continuous continuous listing -l, --listening display listening ser

46、ver sockets -a, --all, --listening display all sockets (default: connected) -o, --timers display timers -F, --fib display Forwarding Information Base (default) -C, --cache display routing cache instead of FIB

47、 -T, --notrim stop trimming long addresses -Z, --context display SELinux security context for sockets : Name of interface to monitor/list. ={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom =Use '-A

48、>' or '--'; default: inet List of possible address families (which support routing): inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25) 示例:查询所有端口和相应的程序,不解析主机名 [root@localhost ~]# netstat -anp Act

49、ive Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 822/rpcbind tcp 0 0 0.0.0.0:56912

50、 0.0.0.0:* LISTEN 835/rpc.statd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1405/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 902/cupsd tcp 0 0 127.0.0.1:25

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服