UNIX/Linux 系统管理技术手册阅读(十)

简介:

2016.11.4 9:30-10:15

Adding new software

If you do need to install additional software, you first need to determine the canonical name of the relevant software package. For example, you’d need to translate “I want to install locate” to “I need to install the findutils package,” or translate “I need named” to “I have to install BIND.” A variety of system-specific indexes on the web can help with this, but Google is usually just as effective. For example, a search for “locate command” takes you directly to several relevant discussions. If you’re on a UNIX system, throw in the name of the operating system as well.

1.12.2 增加新软件

  如果需要安装额外的软件,首先要确定相关软件包的标准名称。例如,需要把“我想装locate”转移为“我需要安装findutils软件包”,或者把“我要named”转移为“我必须安装BIND”。在网上各种针对特定系统的索引能够帮助做转换,但是Google通常更有效。例如,搜索“locate命令”,就能直接找到若干与之相关的讨论。如果是在UNIX系统上,那么还需要输入操作系统的名字。

Once you know the name of the relevant software, you can download and install it. The complete installation is usually a single command on Linux systems and on Solaris systems that have pkgutil installed. For HP-UX and AIX you’ll have to download either a prebuilt binary package or the project’s original source code. If the latter, try to locate the project’s official web page through Google and download the source code from one of the project’s mirrors.

  一旦知道了相关软件的确切名称,就可以下载并安装它。在Linux和安装了pkutil的Solaris系统上,整个安装过程通常用一条命令就够了,对于HP-UX和AIX而言,则要么下载预编译好的二进制软件包,要么下载项目的源代码。如果是后者,需要通过Google定位该项目的正式网站,然后从项目的镜像站点之一下载源代码。

The following examples show the installation of the wget command on each ofour example systems. It’s a nifty GNU utility that turns HTTP and FTP downloads into atomic commands—very useful for scripting. wget is installed by default on each of our example Linux systems, but the commands shown below can be used for both initial installation and later updates.

Ubuntu uses APT, the Debian Advanced Package Tool:

ubuntu# apt-get install wget


The SUSE version is

suse# yast --install wget


The Red Hat version is

redhat# yum install wget


On a Solaris system with pkutil already installed (see blastwave.org for instructions on setting this up)

solaris# /opt/csw/bin/pkgutil --install wget

<multiple pages of output as seven packages are installed>


For HP-UX, we found an appropriate binary package on hpux.connect.org.uk and

downloaded it to the /tmp directory. The commands to unpack and install it were

hpux# gunzip /tmp/wget-1.11.4-hppa-11.31.depot.gz

hpux# swinstall -s /tmp/wget-1.11.4-hppa-11.31.depot wget

  下面的例子展示了在我们的每一种示例系统上安装wget命令。它是一个很棒的GNU工具,能够把HTTP和FTP下载变成单条命令---对于脚本编程来说非常有用。我们所举的每种Linux系统默认都安装了wget,但是下面给出的命令用于初始化安装和后续升级。

The package depot on the swinstall command line must be specified as a full path starting with /; otherwise, swinstall tries to find the file on the network. The wget at the end tells swinstall which package to install from within the depot file.

  在swinstallw不像话地里出现的depot软件包必须用/开头的完整路径;否则,swinstall就会到网络上找文件。最后的wget告诉swinstall从depot文件里安装哪个软件包。

Unfortunately, the installation is not really as easy as it first appears. The installed

version of wget won’t actually run because several of the libraries on which it depends have not been installed:

hpux$ wget http://samba.org/samba/docs/Samba3-HOWTO.pdf

/usr/lib/dld.sl: Can't open shared library: /usr/local/lib/libcrypto.sl

/usr/lib/dld.sl: No such file or directory

[HP ARIES32]: Core file for 32 bit PA-RISC application

[HP ARIES32]: /usr/local/bin/wget saved to /tmp/core.wget.

  遗憾的是,这个安装各种没有乍看上去那么简单。装好的wget版本实际上无法运行,因为没有装它所依赖的几个库。

swinstall does have some dependency management built in, but its abilities unfortunately do not extend to Internet repositories. You’ll have to read the fine print and install all the appropriate prerequisite packages (in this case, six more) to make things right.

  swinstall内置有依赖关系的管理机制,但是遗憾的是,它的这种功能不能延伸到Internet上的软件库里。用户不得不根据提示安装预装的软件包(本例中有6个之多)以达到最终目录。


Building software from source code

There is in fact at least one binary wget package available for AIX in RPM format. A Google search for “aix wget rpm” should turn up some good leads. After downloading, the installation command would be a simple

aix# rpm --install wget-1.11.4-1.aix5.1.ppc.rpm

1.12.3 从源代码编译软件

  实际上,wget到少存在一种可用于AIX的二进制软件包,它是RPM格式的。用Google搜索“aix wget rpm”应该就能找到一些不错的线索。下载下载之后,安装命令很简单

aix# rpm --install wget-1.11.4-1.aix5.1.ppc.rpm

But just for illustration, let’s build the AIX version of wget from the original source code.

  但是为了演示,我们从源代码开始编译AIX版本的wget

Our first chore is to find the code, but that’s easy: the first Google result for “wget”

takes us right to the project page at GNU, and the source tarball is just a link away.

After downloading the current version into the /tmp directory, we unpack, configure, build, and install it:

aix# cd /tmp; gunzip wget-1.11.4.tar.gz

aix# tar xfp wget-1.11.4.tar

aix# cd wget-1.11.4

aix# ./configure --disable-ssl --disable-nls # See comments below

configure: configuring for GNU Wget 1.11.4

checking build system type... rs6000-ibm-aix

config.status: creating src/config.h

config.status: executing default commands

generating po/POTFILES from ./po/POTFILES.in

creating po/Makefile

aix# make

<several pages of compilation output>

aix# make install

<about a page of output>  

  我们的第一项任务是找到代码,这很容易:用google搜索“wget”得到的第一个结果就正好把我们指向GNU的wget项目,再点一下就能找到源代码的tar包。反当前版本的代码下载到/tmp目录里,再解开、配置和安装:

This configure/make/make install sequence is common to the majority of UNIX and Linux software and works on all systems as long as you have the development environment and any package-specific prerequisites installed. However, it’s always a good idea to check the package’s INSTALL or README file for specifics.

  对于大多数UNIX和Linux软件来说,都可以依次执行configure/make/make install三条命令,只要已经安装了开发环境以及预先要求的软件包,就会得到结果。不过,最好查看软件包的INSTALL或者README文件,了解该软件的特别之处。

In this case, the --disable-ssl and --disable-nls options to configure omit some wget features that depend on other libraries that haven’t been installed. In real life, you’d probably want to install the prerequisites. Use configure --help to see all the configuration options. Another useful configure option is --prefix=directory, which lets you put the software somewhere other than /usr/local.

  在这个例子里,configure命令的两个选项--disable-ssl--disable-nls省略了wget的一些特性,这些特性要依赖其他一些还没有安装的库。在实际中,用户可能想还是安装要求预装的那些库。使用confiugre--help查看所有的配置选项。另一个有用的配置选项是--perfix=directory,这个选项可以把软件安装到/usr/local之外的其他目录里。


2016.11.5 9:30-10:10

1.13 SYSTEM ADMINISTRATION UNDER DURESS

System administrators wear many hats. In the real world, they are often people with other jobs who have been asked to look after a few computers on the side. If this is your situation, tread carefully and be aware of how this scenario tends to play out over the long term.

1.13 重压下的系统管理员

  系统管理员通常有多种身份。在现实生活中,系统管理员经常从事其他工作,但同时又被请来管理身边的一些计算机。如果您是处于这种情形之下,那么也许想要考虑一下长期兼职最终可能出现的情况。

The more experienced you become at system management, the more the user community comes to depend on you. Networks invariably grow, and administrative work tends to accumulate over time as your administration system becomes more sophisticated and you add additional layers. You will soon find that you are the only person in your organization who knows how to perform a variety of important tasks.

  您的系统管理经验越丰富,那么用户群体对您的依赖也就越大。网络规模总是在增长,随着管理系统变得越发复杂,管理工作花费的时间也就会越多。很快,您就会发现在您所在的机构中,您成了唯一懂得怎样去执行各种重要任务的人。

Once coworkers come to think of you as the local system administrator, it is difficult to extricate yourself from this role. That is not necessarily a bad thing, but we know several people who have changed jobs to escape it. Since many administrative tasks are intangible, you may also find that you’re expected to be both a fulltime administrator and a full-time engineer, writer, or analyst.

  一旦同事们开始把您看作是本地的系统管理员,那时要把自己从这种角色中解救出来就很困难了。那虽说不一定是件坏事,但我们知道有几个人为了逃避状态已经换了工作。由于许多管理任务是无形的,您还可能发现自己所在的单位希望您既成为一名全职的系统管理员,同时也成为全职的工作师、作家或分析员。

There is a common tendency for unwilling administrators to fend off requests by adopting a surly attitude and providing poor service.10 This approach usually backfires; it makes you look bad and creates additional problems.

  不乐意这样做的系统管理员,常常倾向于通过态度不好和服务差劲来摆脱这类要求。这种方法往往事与愿违,不但有损自己的形象,并且可能产生更多问题。

Instead, consider keeping detailed records of the time you spend on system administration. Your goal should be to keep the work at a manageable level and to assemble evidence that you can use when you ask to be relieved of administrative duties. In most organizations, you will need to lobby the management from six months to a year to get yourself replaced, so plan ahead.

  相反,可以考虑把花费在系统管理上的时间详细记录下来。您的目录应该是保持其工作处于可以管理的水平,而且应该搜集让您在申请减轻管理任务时用得上的证据。在大多数单位里,您需要游说管理层半年到一年的时间以后,才可能让自己的管理员位置由别人来取代,因此应该提前计划好。  

On the other hand, you may find that you enjoy system administration and that you prefer it to real work. Employment prospects remain good. Unfortunately, your political problems will probably intensify. See Chapter 32, Management, Policy, and Politics, for a preview of the delights in store.

  另一方面,您可能发现自己喜欢系统管理员的工作,而且喜欢程序超过了本职工作。好处是职业前景保持良好,不好之处是,您的政治问题可能会激化。参考第32章,事先做好准备。

1.14 RECOMMENDED READING

ROBBINS, ARNOLD. UNIX in a Nutshell (4th Edition). Sebastopol, CA: O’Reilly Media, 2008.

SIEVER, ELLEN, AARON WEBER, AND STEPHEN FIGGINS. Linux in a Nutshell (5th Edition). Sebastopol, CA: O’Reilly Media, 2006.

GANCARZ, MIKE. Linux and the Unix Philosophy. Boston: Digital Press, 2003. SALUS, PETER H. The Daemon, the GNU & the Penguin: How Free and Open Software is Changing the World. Reed Media Services, 2008.

This fascinating history of the open source movement by UNIX’s best-known historian is also available at groklaw.com under the Creative Commons license. The URL for the book itself is quite long; look for a current link at groklaw.com or try this compressed equivalent:tinyurl.com/d6u7j.

RAYMOND, ERIC S. The Cathedral & The Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary. Sebastopol, CA: O’Reilly Media, 2001.

  在groklaw.com上,可以找到由知名的UNIX历史学家写的开源运动的多彩多资的发展史,这本书采用Creative Commons许可证。它自己的URL链接相当长;到grklaw.com上找当前的链接,或者试试这个等价的链接:tinyurl.com/d6u7j.

RAYMOND, ERIC S. The Cathedral & The Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary. Sebastopol, CA: O’Reilly Media, 2001.


System administration

LIMONCELLI, THOMAS A., CHRISTINA J. HOGAN, AND STRATA R. CHALUP. The Practice of System and Network Administration (Second Edition). Reading, MA: Addison-Wesley, 2008.

This is a good book with particularly strong coverage of the policy and procedural aspects of system administration. The authors maintain a system administration blog at everythingsysadmin.com.

FRISCH, AELEEN. Essential System Administration (3rd Edition). Sebastopol, CA: O’Reilly Media, 2002.

This is a classic all-around guide to UNIX system administration that is sadly somewhat out of date. We hope a new version is in the works!

系统管理

LIMONCELLI, THOMAS A., CHRISTINA J. HOGAN, AND STRATA R. CHALUP. The Practice of System and Network Administration (Second Edition). Reading, MA: Addison-Wesley, 2008.

  这是一本好耶,它的强项在于讲述系统管理的政策和堆积方向的内容。作者们在everythingsysadmin.com上维护着一个系统管理方向的博客。

FRISCH, AELEEN. Essential System Administration (3rd Edition). Sebastopol, CA: O’Reilly Media, 2002.

  这是一本UNIX系统管理的经典指南,但遗憾的是内容有点过时。我们希望有出新版本的规划!






      本文转自cix123  51CTO博客,原文链接:http://blog.51cto.com/zhaodongwei/1869234,如需转载请自行联系原作者



相关文章
|
13天前
|
机器学习/深度学习 自然语言处理 Linux
【专栏】Linux 中的机器学习:Whisper适用于语音助手、翻译等领域,随着技术发展,其应用前景广阔
【4月更文挑战第28天】本文探讨了在Linux环境下,先进自动语音识别系统Whisper的运用与实现高效ASR。Whisper基于PyTorch,支持多语言识别,具有高准确性和实时性。文中介绍了安装配置Whisper的步骤,包括安装依赖、下载代码、配置环境变量及编译安装。通过数据准备、模型训练和识别,可实现语音识别功能。Whisper适用于语音助手、翻译等领域,随着技术发展,其应用前景广阔。
|
14天前
|
Cloud Native Linux 开发者
【Docker】Docker:解析容器化技术的利器与在Linux中的关键作用
【Docker】Docker:解析容器化技术的利器与在Linux中的关键作用
|
11天前
|
前端开发 Linux iOS开发
【Flutter前端技术开发专栏】Flutter在桌面应用(Windows/macOS/Linux)的开发实践
【4月更文挑战第30天】Flutter扩展至桌面应用开发,允许开发者用同一代码库构建Windows、macOS和Linux应用,提高效率并保持平台一致性。创建桌面应用需指定目标平台,如`flutter create -t windows my_desktop_app`。开发中注意UI适配、性能优化、系统交互及测试部署。UI适配利用布局组件和`MediaQuery`,性能优化借助`PerformanceLogging`、`Isolate`和`compute`。
【Flutter前端技术开发专栏】Flutter在桌面应用(Windows/macOS/Linux)的开发实践
|
12天前
|
消息中间件 缓存 监控
Linux 常用命令汇总(八):系统管理 & 性能监视
Linux 常用命令汇总(八):系统管理 & 性能监视
|
12天前
|
Linux Shell 虚拟化
【Linux学习】Linux 的虚拟化和容器化技术
【Linux学习】Linux 的虚拟化和容器化技术
|
13天前
|
存储 监控 Linux
【专栏】在 Linux 中,了解已安装驱动器是系统管理的关键
【4月更文挑战第28天】在 Linux 中,了解已安装驱动器是系统管理的关键。本文介绍了三种方法:1) 使用 `lsblk` 命令显示设备名、大小和类型;2) `fdisk -l` 命令提供详细分区信息;3) `gnome-disks` 等系统管理工具展示驱动器信息。此外,还讨论了驱动器类型识别、挂载点概念及其应用。通过这些方法,用户能有效地监控和管理 Linux 系统中的驱动器。
|
13天前
|
安全 Linux 数据安全/隐私保护
【专栏】在 Linux 系统中,掌握查找文件所有者的方法对于系统管理和安全审计至关重要
【4月更文挑战第28天】在 Linux 系统中,掌握查找文件所有者的方法对于系统管理和安全审计至关重要。本文介绍了基本和高级技巧:使用`ls -l`和`stat`命令查看文件详细信息,通过文件路径、通配符或结合`find`、`grep`命令进行查找。实际案例包括查找特定、多个及隐藏文件的所有者。注意权限、文件系统类型和系统环境可能影响查找。了解这些方法能提升 Linux 系统管理效率。
|
13天前
|
监控 Linux 开发者
【专栏】在Linux系统管理中,终止不响应或资源消耗大的进程至关重要
【4月更文挑战第28天】在Linux系统管理中,终止不响应或资源消耗大的进程至关重要。本文介绍了如何查找、终止和监控进程。使用`ps`和`grep`组合查找特定进程,或通过`pgrep`获取PID。使用`kill`命令(默认发送TERM信号)终止进程,如需强制终止,可使用`kill -9`发送`SIGKILL`信号。监控进程可借助`ps`、`top`、`htop`及`watch`命令。理解这些技能将有助于更有效地管理Linux进程。
|
13天前
|
安全 Unix Linux
【专栏】`rmdir`命令在Linux和类Unix系统中用于删除空目录,不适用于非空目录
【4月更文挑战第28天】`rmdir`命令在Linux和类Unix系统中用于删除空目录,不适用于非空目录。基本语法为`rmdir [options] directory...`,常用选项包括`-p`(递归删除空父目录)和`--ignore-fail-on-non-empty`(忽略非空目录错误)。与`rm -r`相比,`rmdir`更安全,适用于知道目录为空的情况。在自动化脚本和清理构建目录等场景中,`rmdir`能有效管理空目录。使用时确保目录为空,避免误删,必要时结合`ls`和`sudo`检查或提升权限。
|
13天前
|
Linux 数据库 开发者
【专栏】在Linux系统管理中,熟练使用命令行工具查找文件至关重要:如何按名称和 Grep 内容查找文件?
【4月更文挑战第28天】在Linux系统管理中,熟练使用命令行工具查找文件至关重要。本文介绍了如何使用`find`和`locate`按名称查找文件,以及结合`grep`按内容搜索。`find`能基于多种属性搜索,包括文件系统层次,而`locate`依赖索引数据库,速度更快。`grep`则用于在文件中搜索特定文本,支持正则表达式和多种选项。通过组合`find`/`locate`和`grep`,可实现更复杂的搜索任务,提升工作效率。