From d6c50a390ba637b10cf1826d918031b67f7d5b28 Mon Sep 17 00:00:00 2001 From: Gore Liu Date: Wed, 20 May 2015 11:16:28 +0800 Subject: [PATCH 1/9] [Translated] 20150423 20 Awesome Docker Containers for a Desktop User.md --- ...me Docker Containers for a Desktop User.md | 239 ------------------ ...me Docker Containers for a Desktop User.md | 236 +++++++++++++++++ 2 files changed, 236 insertions(+), 239 deletions(-) delete mode 100644 sources/tech/20150423 20 Awesome Docker Containers for a Desktop User.md create mode 100644 translated/tech/20150423 20 Awesome Docker Containers for a Desktop User.md diff --git a/sources/tech/20150423 20 Awesome Docker Containers for a Desktop User.md b/sources/tech/20150423 20 Awesome Docker Containers for a Desktop User.md deleted file mode 100644 index 00786e9bde..0000000000 --- a/sources/tech/20150423 20 Awesome Docker Containers for a Desktop User.md +++ /dev/null @@ -1,239 +0,0 @@ -Translating by gaoliu ... - -20 Awesome Docker Containers for a Desktop User -================================================================================ -Greetings to everyone, today we'll list out some awesome Desktop Apps that we can run using Docker Containers in our very own Desktop running Docker. Docker is an Open Source project that provides an open platform to pack, ship and run any application as a lightweight container. It has no boundaries of Language support, Frameworks or packaging system and can be run anywhere, anytime from a small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider. It is basically used by the developers, Ops and Engineers as it is easy, fast and handy tool for testing or deploying their products but we can also use Docker for our Desktop usage to run a desktop apps out of the box. - -So here are some awesome 10 Desktop Application Docker images that we can run with Docker. - -### 1. Lynx ### - -Lynx is a all time favorite text-based web browser which is a lot familiar to most of the people running Linux. It is the oldest web browser currently in general use and development. To run Lynx, run the following command. - - $ docker run -it \ - --name lynx \ - jess/lynx - -### 2. Irssi ### - -Irssi is an awesome IRC Client which is based on Text Interface. To run Irssi using docker, we'll need to run the following commands in a docker installed desktop computer. - - docker run -it --name my-irssi -e TERM -u $(id -u):$(id -g) \ - -v $HOME/.irssi:/home/user/.irssi:ro \ - -v /etc/localtime:/etc/localtime:ro \ - irssi - -### 3. Chrome ### - -Chrome is an awesome GUI-based web browser developed by Google and is based on Open Source Project Chromium. Google Chrome is widely used, fast and secure web browser that are very much familiar to most of the people who surf internet. We can run Chrome using docker by running the following command. - - $ docker run -it \ - --net host \ - --cpuset 0 \ - --memory 512mb \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=unix$DISPLAY \ - -v $HOME/Downloads:/root/Downloads \ - -v $HOME/.config/google-chrome/:/data \ - -v /dev/snd:/dev/snd --privileged \ - --name chrome \ - jess/chrome - -### 4. Tor Browser ### - -Tor Browser is a web browser which support anonymous features. It enables us freedom to surf website or services blocked by a particular organization or ISPs. It prevents somebody watching our Internet connection from learning what we do on internet and our exact location. To run Tor Browser, run the following command. - - $ docker run -it \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=unix$DISPLAY \ - -v /dev/snd:/dev/snd --privileged \ - --name tor-browser \ - jess/tor-browser - -### 5. Firefox Browser ### - -Firefox Browser is a free and open source web browser which is developed by Mozilla Foundation. It is run by Gecko and SpiderMonkey engines. Firefox Browser has a lot of new features and is specially known for its performance and security. - - $ docker run -d \ - --name firefox \ - -e DISPLAY=$DISPLAY \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - kennethkl/firefox - -### 6. Rainbow Stream ### - -Rainbow Stream is a terminal based Twitter Client featuring real time tweetstream, compose, search , favorite and much more fun directly from terminal. To run Rainbow Stream, run the following command. - - $ docker run -it \ - -v /etc/localtime:/etc/localtime \ - -v $HOME/.rainbow_oauth:/root/.rainbow_oauth \ - -v $HOME/.rainbow_config.json:/root/.rainbow_config.json \ - --name rainbowstream \ - jess/rainbowstream - -### 7. Gparted ### - -Gparted is an open source software which allows us to partition disks. Now enjoy partitioning from a docker container. To run gparted, we'll need to run the following command. - - $ docker run -it \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=unix$DISPLAY \ - --device /dev/sda:/dev/sda \ # mount the device to partition - --name gparted \ - jess/gparted - -### 8. GIMP Editor ### - -GIMP stands for Gnu Image Manipulation Program which is an awesome tool on Linux for graphics, image editing platform. It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. - - $ docker run -it \ - --rm -e DISPLAY=$DISPLAY \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - jarfil/gimp-git - -### 9. Thunderbird ### - -Thunderbird is also a free and open source email application which is developed and maintained by Mozilla Foundation. It has tons of features that an email application software should have. Thunderbird is really easy to setup and customize. To run Thunderbird in a Docker environment, run the following command. - - $ docker run -d \ - -e DISPLAY \ - -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -u docker \ - -v $HOME/docker-data/thunderbird:/home/docker/.thunderbird/ \ - yantis/thunderbird thunderbird - -### 10. Mutt ### - -Mutt is a text based email client which has bunches of cool features including color support, IMAP, POP3, SMTP support, mail storing support and much more. To run Mutt out of the box using docker, we'll need to run the following command. - - $ docker run -it \ - -v /etc/localtime:/etc/localtime \ - -e GMAIL -e GMAIL_NAME \ - -e GMAIL_PASS -e GMAIL_FROM \ - -v $HOME/.gnupg:/home/user/.gnupg \ - --name mutt \ - jess/mutt - -### 11. Skype ### - -Skype is an instant messaging, video calling software which is not open source but can be run awesome in linux. We can run Skype using Docker Containers too. To run Skype using a docker, run the following command. - - $ docker run -it \ - -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -v /dev/snd:/dev/snd --privileged \ - -e DISPLAY="unix$DISPLAY" \ - tianon/skype - -### 12. Cathode ### - -Cathode is a beautiful fully customizable terminal app with a look inspired by classic computers. We can run Cathode by running the below command. - - $ docker run -it \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=unix$DISPLAY \ - --name cathode \ - jess/1995 - -### 13. LibreOffice ### - -LibreOffice is a powerful office suite which is free and open source and is maintained by The Document Foundation. It has clean interface and is a powerful tools that lets us unleash our creativity and grow our productivity. LibreOffice embeds several applications that make it the most powerful Free & Open Source Office suite on the market. - - $docker run \ - -v $HOME/Documents:/home/libreoffice/Documents:rw \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e uid=$(id -u) -e gid=$(id -g) \ - -e DISPLAY=unix$DISPLAY --name libreoffice \ - chrisdaish/libreoffice - -### 14. Spotify ### - -Spotify gives us instant access to millions of songs from old favorites to the latest hits. To listen our favorite songs using docker, run the following command. - - $ docker run -it \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=unix$DISPLAY \ - -v /dev/snd:/dev/snd --privileged \ - --name spotify \ - jess/spotify - -### 15. Audacity ### - -Audacity is free and open source cross-platform software for recording and editing sounds. Audacity can be used for post-processing of all types of audio, including podcasts by adding effects such as normalization, trimming, and fading in and out. To run Audacity, we'll need to run the following command in a terminal or shell. - - $ docker run --rm \ - -u $(id -u):$(id -g) \ - -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -v /dev/snd:/dev/snd \ - -v "$HOME:$HOME" \ - -w "$HOME" \ - -e DISPLAY="unix$DISPLAY" \ - -e HOME \ - $(find /dev/snd/ -type c | sed 's/^/--device /') \ - knickers/audacity - -### 16. Eclipse ### - -Eclipse is an integrated development environment (IDE). It contains a base workspace and an extensible plug-in system for customizing the environment. It is mostly used to develop Java Based Applications. - - $ docker run -v ~/workspace/:/home/eclipse/workspace/ \ - -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -d leesah/eclipse - -### 17. VLC Media Player ### - -VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols. VLC Media Player is developed and maintained by VideoLAN Organization. To run VLC in docker environment, run the following command. - - $ docker run -v\ - $HOME/Documents:/home/vlc/Documents:rw \ - -v /dev/snd:/dev/snd --privileged \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e uid=$(id -u) -e gid=$(id -g) \ - -e DISPLAY=unix$DISPLAY --name vlc \ - chrisdaish/vlc - -### 18. Vim Editor ### - -Vim is a highly configurable text-based text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. - - $ docker run -i -t --name my-vim -v ~/:/home/dev/src haron/vim - -### 19. Inkscape ### - -Inkscape is a free and open-source vector graphics editor. It can create, edit vector graphics such as illustrations, diagrams, line arts, charts, logos and even complex paintings. Inkscape's primary vector graphics format is Scalable Vector Graphics (SVG) version 1.1. It can import from or export to several other formats as well but all editing workflow must inevitably occur within the constraints of SVG format. - - $docker build -t rasch/inkscape --rm . - $ docker run --rm -e DISPLAY \ - -u inkscaper - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -v $HOME/.Xauthority:/home/inkscaper/.Xauthority \ - --net=host rasch/inkscape - -### 20. Filezilla ### - -Filezilla is a free FTP solution application software. It supports FTP, SFTP, FTPS protocols. It is a powerful file management tool for client side. It is an awesome open source FTP project which is highly reliable and easy to use. - - $ xhost +si:localuser:$(whoami) - $ docker run \ - -d \ - -e DISPLAY \ - -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -u docker \ - -v /:/host \ - -v $HOME/docker-data/filezilla:/home/docker/.config/filezilla/ \ - yantis/filezilla filezilla - -### Conclusion ### - -Running desktop application software using Docker is really an awesome experience. Docker is really an awesome platform for fast and easy development, shipping and deployment of software and packages in any place from home to office to production areas. Running desktop apps with docker is a cool way to try out the apps without really installing it into the host filesystem. So, if you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! Enjoy with Docker :-) - --------------------------------------------------------------------------------- - -via: http://linoxide.com/how-tos/20-docker-containers-desktop-user/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/translated/tech/20150423 20 Awesome Docker Containers for a Desktop User.md b/translated/tech/20150423 20 Awesome Docker Containers for a Desktop User.md new file mode 100644 index 0000000000..055c1eb9b5 --- /dev/null +++ b/translated/tech/20150423 20 Awesome Docker Containers for a Desktop User.md @@ -0,0 +1,236 @@ +20个为桌面用户准备的令人惊叹的Docker容器 +================================================================================ +大家好,今天我们会列出一些很棒的运行在Docker容器中的桌面软件,我们可以在自己的桌面系统中运行它们。Docker是一个开源的项目,它提供可以将应用程序作为一个轻量级容器来打包、传送和运行的开放平台。它没有语言支持、框架或打包系统的限制,可以运行在任何地方,从小型的家用电脑到高端的服务器。它可以使部署和扩展web应用程序、数据库和后端服务像搭积木一样容易,而不依赖特定技术栈或提供商。它主要是由开发、运维工程师使用的,因为它简单、快速和方便,可以用来测试和辅助开发他们产品,但是我们也可以在桌面环境使用Docker,这样一些桌面程序可以开箱即用。 + +下边是20个非常棒的桌面软件docker镜像,我们可以使用Docker来运行。 + +### 1. Lynx ### + +Lynx是一个一直以来最受欢迎的文本界面网页浏览器,它对多数Linux用户来说都很熟悉。它应该是现在还在日常和开发环境中被使用的最古老的网页浏览器了。可以使用如下命令运行Lync。 + + $ docker run -it \ + --name lynx \ + jess/lynx + +### 2. Irssi ### + +Irssi是一个非常棒的文本界面IRC客户端。可以使用如下命令运行Irssi。 + + docker run -it --name my-irssi -e TERM -u $(id -u):$(id -g) \ + -v $HOME/.irssi:/home/user/.irssi:ro \ + -v /etc/localtime:/etc/localtime:ro \ + irssi + +### 3. Chrome ### + +Chrome是一个令人惊叹的图形界面网页浏览器,由Google开发,它基于开源的Chromium项目。Google Chrome是一个被广泛使用的、快速安全的网页浏览器,经常上网的人会非常熟悉它。我们可以使用如下命令在Docker中运行Chrome。 + + $ docker run -it \ + --net host \ + --cpuset 0 \ + --memory 512mb \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v $HOME/Downloads:/root/Downloads \ + -v $HOME/.config/google-chrome/:/data \ + -v /dev/snd:/dev/snd --privileged \ + --name chrome \ + jess/chrome + +### 4. Tor浏览器 ### + +Tor浏览器是一个支持匿名访问的网页浏览器。它让我们可以自由地在网络世界遨游,或者浏览被特定组织或者网络服务提供商封锁的网站。它会阻止有人通过监视我们的网络连接来窃取我们在网络上的一举一动以及我们的确切位置。运行如下命令运行Tor浏览器。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v /dev/snd:/dev/snd --privileged \ + --name tor-browser \ + jess/tor-browser + +### 5. Firefox浏览器 ### + +Firefox浏览器是一个自由并且开源的网页浏览器,它由Mozilla基金会开发。它使用Gecko和SpiderMonkey引擎。Firefox浏览器有很多新特性,并且它以性能和安全性著称。 + + $ docker run -d \ + --name firefox \ + -e DISPLAY=$DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + kennethkl/firefox + +### 6. Rainbow Stream ### + +Rainbow Stream是一个文本界面的Twitter客户端,有实时显示tweetstream、搜索、喜欢和更多其他特性,可以直接在终端使用。使用如下命令运行Rainbow Stream。 + + $ docker run -it \ + -v /etc/localtime:/etc/localtime \ + -v $HOME/.rainbow_oauth:/root/.rainbow_oauth \ + -v $HOME/.rainbow_config.json:/root/.rainbow_config.json \ + --name rainbowstream \ + jess/rainbowstream + +### 7. Gparted ### + +Gparted是一个用来给磁盘分区的开源软件。现在可以在Docker容器里享受分区的乐趣。可以使用如下命令运行gparted。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + --device /dev/sda:/dev/sda \ # mount the device to partition + --name gparted \ + jess/gparted + +### 8. GIMP图片编辑器 ### + +GIMP(Gnu Image Manipulation Program)是一个令人惊叹的Linux图片编辑软件。它是一个可以自由分发的可以处理照片修正、图像合成和图像创作等任务的工具。 + + $ docker run -it \ + --rm -e DISPLAY=$DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + jarfil/gimp-git + +### 9. Thunderbird ### + +Thunderbird是一个自由并且开源的电子邮件软件,它由Mozilla基金会开发和维护。它有众多一个电子邮件软件应该具有的功能。Thunderbird非常易于安装和定制。使用如下命令在Docker中运行Thunderbird。 + + $ docker run -d \ + -e DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -u docker \ + -v $HOME/docker-data/thunderbird:/home/docker/.thunderbird/ \ + yantis/thunderbird thunderbird + +### 10. Mutt ### + +Mutt是一个文本界面的电子邮件客户端,有很多很酷的功能,如颜色支持,IMAP、POP3、SMTP支持,邮件存储支持等。 使用如下命令运行Mutt。 + + $ docker run -it \ + -v /etc/localtime:/etc/localtime \ + -e GMAIL -e GMAIL_NAME \ + -e GMAIL_PASS -e GMAIL_FROM \ + -v $HOME/.gnupg:/home/user/.gnupg \ + --name mutt \ + jess/mutt + +### 11. Skype ### + +Skype是一个支持文字、语音和视频的即时通讯软件,它不是开源的,但在Linux下可以很棒地运行。我们同样可以在Docker中运行Skype,使用如下命令。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -v /dev/snd:/dev/snd --privileged \ + -e DISPLAY="unix$DISPLAY" \ + tianon/skype + +### 12. Cathode ### + +Cathode是一个漂亮并且高度可定制的终端模拟器,灵感来自经典的计算机。使用如下命令运行Cathode。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + --name cathode \ + jess/1995 + +### 13. LibreOffice ### + +LibreOffice是一个功能强大的办公套件,它是自由和开源的,现在由The Document基金会维护。它有干净的界面和强大的功能,让我们释放创造力和提升生产力。LibreOffice将数个应用程序集成在一起,是市面上最强大的自由并且开源的办公套件。 + $docker run \ + -v $HOME/Documents:/home/libreoffice/Documents:rw \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e uid=$(id -u) -e gid=$(id -g) \ + -e DISPLAY=unix$DISPLAY --name libreoffice \ + chrisdaish/libreoffice + +### 14. Spotify ### + +Spotify可以即时访问数百万的歌曲,从经典老歌到最新单曲。可以使用如下命令在Docker中听我们最喜欢的歌曲。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v /dev/snd:/dev/snd --privileged \ + --name spotify \ + jess/spotify + +### 15. Audacity ### + +Audacity是一个自由并且开源的跨平台软件,用来录制和编辑音频。Audacity可以用来做所有类型音频(例如podcast)的后期处理,如归一化、调整、淡入淡出。使用如下命令来运行Audacity。 + + $ docker run --rm \ + -u $(id -u):$(id -g) \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -v /dev/snd:/dev/snd \ + -v "$HOME:$HOME" \ + -w "$HOME" \ + -e DISPLAY="unix$DISPLAY" \ + -e HOME \ + $(find /dev/snd/ -type c | sed 's/^/--device /') \ + knickers/audacity + +### 16. Eclipse ### + +Eclipse是一个集成开发环境。它包含基本的工作区和用来定制环境的可扩展插件系统。它在Java开发者中很流行。 + + $ docker run -v ~/workspace/:/home/eclipse/workspace/ \ + -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -d leesah/eclipse + +### 17. VLC媒体播放器 ### + +VLC是一个自由并且开源的跨平台多媒体播放器,可以播放本地文件、DVD、CD、VCD和各种流媒体。VLC由VideoLAN组织开发和维护。使用如下命令运行VLC。 + + $ docker run -v\ + $HOME/Documents:/home/vlc/Documents:rw \ + -v /dev/snd:/dev/snd --privileged \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e uid=$(id -u) -e gid=$(id -g) \ + -e DISPLAY=unix$DISPLAY --name vlc \ + chrisdaish/vlc + +### 18. Vim编辑器 ### + +Vim是一个高度可配置的文本界面文字编辑器,为高效的文本编辑而生。它是预装在多数UNIX系统中的vi编辑器的改进版本。 + + $ docker run -i -t --name my-vim -v ~/:/home/dev/src haron/vim + +### 19. Inkscape ### + +Inkscape是一个自由并且开源的矢量图形编辑器。它可以创建、编辑矢量图形,如插图、图示、线条艺术、图表、徽标以及更复杂的绘画。Inkscape使用的主要矢量图形格式是SVG 1.1版本。它也可以导入和导出一些其他的格式,但实际编辑使用的还是SVG格式。 + + $docker build -t rasch/inkscape --rm . + $ docker run --rm -e DISPLAY \ + -u inkscaper + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v $HOME/.Xauthority:/home/inkscaper/.Xauthority \ + --net=host rasch/inkscape + +### 20. Filezilla ### + +Filezilla是一个自由的FTP解决方案,支持FTP、SFTP、FTPS协议。它的客户端是一个功能强大的文件管理工具。它是一个很棒的高度可靠和易用的开源FTP解决方案。 + + $ xhost +si:localuser:$(whoami) + $ docker run \ + -d \ + -e DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -u docker \ + -v /:/host \ + -v $HOME/docker-data/filezilla:/home/docker/.config/filezilla/ \ + yantis/filezilla filezilla + +### 总结 ### + +使用Docker运行桌面软件真的是很棒的体验。Docker是一个快速、简单的开发平台,适合从家里、办公室到生产环境里传送和开发软件的场景。使用Docker运行桌面软件是试用而不将其安装到自己实体机文件系统中的很酷的方法。如果你有任何问题、评论或者反馈,清写在下方的评论框中,让我们知道哪些是需要增加或者改进的。谢谢!享受Docker吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/20-docker-containers-desktop-user/ + +作者:[Arun Pyasi][a] +译者:[goreliu](https://github.com/goreliu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ \ No newline at end of file From 9c0a5cc60ccfeabe544beb19caaa90a5e5aef14d Mon Sep 17 00:00:00 2001 From: Gore Liu Date: Wed, 20 May 2015 12:59:11 +0800 Subject: [PATCH 2/9] [Translating] 20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md --- ...ols Send Email with Subject, Body and Attachment in Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md b/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md index 77936b6a67..bc3f02095c 100644 --- a/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md +++ b/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md @@ -1,3 +1,5 @@ +Translating by goreliu ... + 4 Tools Send Email with Subject, Body and Attachment in Linux ================================================================================ In today's article we will cover a few ways you can use to send emails with attachments from the command line interface on Linux. It can have quite a few uses, for example to send an archive with an application from an application server to email or you can use the commands in scripts to automate some process. For our examples,we will use the file foo.tar.gz as our attachment. From 2693e62ddfdd6feed61d1360856f1b21277024b4 Mon Sep 17 00:00:00 2001 From: Gore Liu Date: Wed, 20 May 2015 14:38:40 +0800 Subject: [PATCH 3/9] [Translated] 20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md --- ...h Subject, Body and Attachment in Linux.md | 263 ------------------ ...h Subject, Body and Attachment in Linux.md | 261 +++++++++++++++++ 2 files changed, 261 insertions(+), 263 deletions(-) delete mode 100644 sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md create mode 100644 translated/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md diff --git a/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md b/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md deleted file mode 100644 index bc3f02095c..0000000000 --- a/sources/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md +++ /dev/null @@ -1,263 +0,0 @@ -Translating by goreliu ... - -4 Tools Send Email with Subject, Body and Attachment in Linux -================================================================================ -In today's article we will cover a few ways you can use to send emails with attachments from the command line interface on Linux. It can have quite a few uses, for example to send an archive with an application from an application server to email or you can use the commands in scripts to automate some process. For our examples,we will use the file foo.tar.gz as our attachment. - -There are various ways to send emails from command line using different mail clients but here I am sharing few mail client utility used by most users like mailx, mutt and swaks. - -All the tools we will present to you are very popular and present in the repositories of most Linux distributions, you can install them using the following commands: - -For **Debian / Ubuntu** systems - - apt-get install mutt - apt-get install swaks - apt-get install mailx - apt-get install sharutils - -For Red Hat based systems like **CentOS** or **Fedora** - - yum install mutt - yum install swaks - yum install mailx - yum install sharutils - -### 1) Using mail / mailx ### - -The mailx utility found as the default mailer application in most Linux distributions now includes the support to attach file. If it is not available you can easily install using the following commands please take note that this may not be supported in older versions, to check this you can use the command: - - $ man mail - -And the first line should look like this: - -mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . . - -As you can see it supports the -a attribute to add a file to the email and -s attribute to subject to the email. Use few of below examples to send mails. - -**a) Simple Mail** - -Run the mail command, and then mailx would wait for you to enter the message of the email. You can hit enter for new lines. When done typing the message, press Ctrl+D and mailx would display EOT. - -After than mailx automatically delivers the email to the destination. - - $ mail user@example.com - - HI, - Good Morning - How are you - EOT - -**b) To send email with subject** - - $ echo "Email text" | mail -s "Test Subject" user@example.com - --s is used for defining subject for email. - -**c) To send message from a file** - - $ mail -s "message send from file" user@example.com < /path/to/file - -**d) To send message piped using the echo command** - - $ echo "This is message body" | mail -s "This is Subject" user@example.com - -**e) To send email with attachment** - - $ echo “Body with attachment "| mail -a foo.tar.gz -s "attached file" user@example.com - --a is used for attachments - -### 2) mutt ### - -Mutt is a text-based email client for Unix-like systems. It was developed over 20 years ago and it's an important part of Linux history, one of the first clients to support scoring and threading capabilities. Use few of below examples to send email. - -**a) Send email with subject & body message from a file** - - $ mutt -s "Testing from mutt" user@example.com < /tmp/message.txt - -**b) To send body message piped using the echo command** - - $ echo "This is the body" | mutt -s "Testing mutt" user@example.com - -**c) To send email with attachment** - - $ echo "This is the body" | mutt -s "Testing mutt" user@example.com -a /tmp/foo.tar.gz - -**d) To send email with multiple attachments** - - $ echo "This is the body" | mutt -s "Testing" user@example.com -a foo.tar.gz –a bar.tar.gz - -### 3) swaks ### - -Swaks stands for Swiss Army Knife for SMTP and it is a featureful, flexible, scriptable, transaction-oriented SMTP test tool written and maintained by John Jetmore. You can use the following syntax to send an email with attachment: - - $ swaks -t "foo@bar.com" --header "Subject: Subject" --body "Email Text" --attach foo.tar.gz - -The important thing about Swaks is that it will also debug the full mail transaction for you, so it is a very useful tool if you also wish to debug the mail sending process: - -As you can see it gives you full details about the sending process including what capabilities the receiving mail server supports, each step of the transaction between the 2 servers. - -### 4) uuencode ### - -Email transport systems were originally designed to transmit characters with a seven-bit encoding -- like ASCII. This meant they could send messages with plain text but not "binary" text, such as program files or image files that used all of an eight-bit byte. The program is used to solve this limitation is “uuencode”( "UNIX to UNIX encoding") which encode the mail from binary format to text format that is safe to transmit & program is used to decode the data is called “uudecode” - -We can easily send binary text such as a program files or image files using uuencode with mailx or mutt email client is shown by following example: - - $ uuencode example.jpeg example.jpeg | mail user@example.com - -### Shell Script : Explain how to send email ### - - #!/bin/bash - - FROM="" - SUBJECT="" - ATTACHMENTS="" - TO="" - BODY="" - - # Function to check if entered file names are really files - function check_files() - { - output_files="" - for file in $1 - do - if [ -s $file ] - then - output_files="${output_files}${file} " - fi - done - echo $output_files - } - - echo "*********************" - echo "E-mail sending script." - echo "*********************" - echo - - # Getting the From address from user - while [ 1 ] - do - if [ ! $FROM ] - then - echo -n -e "Enter the e-mail address you wish to send mail from:\n[Enter] " - else - echo -n -e "The address you provided is not valid:\n[Enter] " - fi - - read FROM - echo $FROM | grep -E '^.+@.+$' > /dev/null - if [ $? -eq 0 ] - then - break - fi - done - - echo - - # Getting the To address from user - while [ 1 ] - do - if [ ! $TO ] - then - echo -n -e "Enter the e-mail address you wish to send mail to:\n[Enter] " - else - echo -n -e "The address you provided is not valid:\n[Enter] " - fi - - read TO - echo $TO | grep -E '^.+@.+$' > /dev/null - if [ $? -eq 0 ] - then - break - fi - done - - echo - - # Getting the Subject from user - echo -n -e "Enter e-mail subject:\n[Enter] " - read SUBJECT - - echo - - if [ "$SUBJECT" == "" ] - then - echo "Proceeding without the subject..." - fi - - # Getting the file names to attach - echo -e "Provide the list of attachments. Separate names by space. - If there are spaces in file name, quote file name with \"." - read att - - echo - - # Making sure file names are poiting to real files - attachments=$(check_files "$att") - echo "Attachments: $attachments" - - for attachment in $attachments - do - ATTACHMENTS="$ATTACHMENTS-a $attachment " - done - - echo - - # Composing body of the message - echo "Enter message. To mark the end of message type ;; in new line." - read line - - while [ "$line" != ";;" ] - do - BODY="$BODY$line\n" - read line - done - - SENDMAILCMD="mutt -e \"set from=$FROM\" -s \"$SUBJECT\" \ - $ATTACHMENTS -- \"$TO\" <<< \"$BODY\"" - echo $SENDMAILCMD - - mutt -e "set from=$FROM" -s "$SUBJECT" $ATTACHMENTS -- $TO <<< $BODY - -**Script Output** - - $ bash send_mail.sh - ********************* - E-mail sending script. - ********************* - - Enter the e-mail address you wish to send mail from: - [Enter] test@gmail.com - - Enter the e-mail address you wish to send mail to: - [Enter] test@gmail.com - - Enter e-mail subject: - [Enter] Message subject - - Provide the list of attachments. Separate names by space. - If there are spaces in file name, quote file name with ". - send_mail.sh - - Attachments: send_mail.sh - - Enter message. To mark the end of message type ;; in new line. - This is a message - text - ;; - -### Conclusion ### - -There are many ways of send emails from command line / shell script but here we have shared 4 tools available for unix / linux based distros. Hope you enjoyed reading our article and please provide your valuable comments and also let us know if you know about any new tools. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-shell-script/send-email-subject-body-attachment-linux/ - -作者:[Bobbin Zachariah][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/bobbin/ \ No newline at end of file diff --git a/translated/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md b/translated/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md new file mode 100644 index 0000000000..fe2fa8c5cf --- /dev/null +++ b/translated/tech/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md @@ -0,0 +1,261 @@ +4个可以发送带主题、正文和附件的电子邮件的工具 +================================================================================ +今天的文章里我们会讲到一些使用Linux命令行工具来发送带附件的电子邮件的方法。它有很多用处,比如在应用程序所在服务器上,使用电子邮件发送一个档案过来,或者你可以在脚本中使用这些命令来做一些自动化操作。在本文的例子中,我们会使用foo.tar.gz文件作为附件。 + +有不同的命令行工具可以发送邮件,这里我分享几个多数用户会使用的工具,如`mailx`、`mutt`和`swaks`。 + +我们即将呈现的多数工具都是非常有名的,并且存在于多数Linux发行版默认的软件仓库中,你可以使用如下命令安装: + +在 **Debian / Ubuntu** 系统 + + apt-get install mutt + apt-get install swaks + apt-get install mailx + apt-get install sharutils + +在基于Red Hat的系统,如 **CentOS** 或者 **Fedora** + + yum install mutt + yum install swaks + yum install mailx + yum install sharutils + +### 1) 使用 mail / mailx ### + +`mailx`工具在多数Linux发行版中是默认的邮件程序,现在已经支持发送附件了。如果它不在你的系统中,你可以使用上边的命令安装。有一点需要注意,老版本的mailx可能不支持发送附件,运行如下命令查看是否支持。 + + $ man mail + +第一行看起来是这样的: + + mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . . + +如果你看到它支持`-a`的选项(-a 文件名,将文件作为附件添加到邮件)和`-s`选项(-s 主题,指定邮件的主题),就是支持的。可以使用如下的几个例子发送邮件。 + +**a) 简单的邮件 ** + +运行`mail`命令,然后`mailx`会等待你输入邮件内容。你可以按回车来换行。当输入完成后,按Ctrl + D,`mailx`会显示EOT。 + +然后`mailx`会自动将邮件发送给收件人。 + + $ mail user@example.com + + HI, + Good Morning + How are you + EOT + +**b) 发送有主题的邮件 ** + + $ echo "Email text" | mail -s "Test Subject" user@example.com + +`-s`的用处是指定邮件的主题。 + +**c) 从文件中读取邮件内容并发送 ** + + $ mail -s "message send from file" user@example.com < /path/to/file + +**d) 将从管道获取到的`echo`命令输出作为邮件内容发送 ** + + $ echo "This is message body" | mail -s "This is Subject" user@example.com + +**e) 发送带附件的邮件 ** + + $ echo “Body with attachment "| mail -a foo.tar.gz -s "attached file" user@example.com + +`-a`选项用于指定附件。 + +### 2) mutt ### + +Mutt是类Unix系统上的一个文本界面邮件客户端。它有20多年的历史,在Linux历史中也是一个很重要的部分,它是最早支持进程打分和多线程处理的程序之一。按照如下的例子来发送邮件。 + +**a) 从文件中读取邮件的主题和正文,并发送 ** + + $ mutt -s "Testing from mutt" user@example.com < /tmp/message.txt + +**b) 将从管道获取到的`echo`命令输出作为邮件内容发送 ** + + $ echo "This is the body" | mutt -s "Testing mutt" user@example.com + +**c) 发送带附件的邮件 ** + + $ echo "This is the body" | mutt -s "Testing mutt" user@example.com -a /tmp/foo.tar.gz + +**d) 发送带有多个附件的邮件 ** + + $ echo "This is the body" | mutt -s "Testing" user@example.com -a foo.tar.gz –a bar.tar.gz + +### 3) swaks ### + +Swaks(Swiss Army Knife,瑞士军刀)是SMTP的瑞士军刀,它功能强大、灵活、可编程、面向事务的SMTP测试工具,由John Jetmore开发和维护。你可以使用如下语法发送带附件的邮件: + + $ swaks -t "foo@bar.com" --header "Subject: Subject" --body "Email Text" --attach foo.tar.gz + +关于Swaks一个重要的事情是,它会为你显示整个邮件发送过程,所以如果你想调试邮件发送过程,它是一个非常有用的工具: + +正如你看到的那样,它给你提供了邮件发送过程的所有细节,包括邮件接收服务器的功能支持、两个服务器之间的每一步交互。 + +### 4) uuencode ### + +邮件传输系统最初是被设计来传送7位编码(类似ASCII)的内容的。这就意味这它是用来发送文本内容,而不能发会使用8个位的二进制内容(如程序文件或者图片)。`uuencode`(“UNIX to UNIX encoding”,UNIX之间使用的编码方式)程序用来解决这个限制。使用`uuencode`,发送端将二进制格式的转换成文本格式来传输,接收端再转换回去。 + +我们可以简单地使用`uuencode`和`mailx`或者`mutt`配合,来发送二进制内容,类似这样: + + $ uuencode example.jpeg example.jpeg | mail user@example.com + +### Shell脚本:解释如何发送邮件 ### + + #!/bin/bash + + FROM="" + SUBJECT="" + ATTACHMENTS="" + TO="" + BODY="" + + # 检查文件名对应的文件是否存在 + function check_files() + { + output_files="" + for file in $1 + do + if [ -s $file ] + then + output_files="${output_files}${file} " + fi + done + echo $output_files + } + + echo "*********************" + echo "E-mail sending script." + echo "*********************" + echo + + # 读取用户输入的邮件地址 + while [ 1 ] + do + if [ ! $FROM ] + then + echo -n -e "Enter the e-mail address you wish to send mail from:\n[Enter] " + else + echo -n -e "The address you provided is not valid:\n[Enter] " + fi + + read FROM + echo $FROM | grep -E '^.+@.+$' > /dev/null + if [ $? -eq 0 ] + then + break + fi + done + + echo + + # 读取用户输入的收件人地址 + while [ 1 ] + do + if [ ! $TO ] + then + echo -n -e "Enter the e-mail address you wish to send mail to:\n[Enter] " + else + echo -n -e "The address you provided is not valid:\n[Enter] " + fi + + read TO + echo $TO | grep -E '^.+@.+$' > /dev/null + if [ $? -eq 0 ] + then + break + fi + done + + echo + + # 读取用户输入的邮件主题 + echo -n -e "Enter e-mail subject:\n[Enter] " + read SUBJECT + + echo + + if [ "$SUBJECT" == "" ] + then + echo "Proceeding without the subject..." + fi + + # 读取作为附件的文件名 + echo -e "Provide the list of attachments. Separate names by space. + If there are spaces in file name, quote file name with \"." + read att + + echo + + # 确保文件名指向真实文件 + attachments=$(check_files "$att") + echo "Attachments: $attachments" + + for attachment in $attachments + do + ATTACHMENTS="$ATTACHMENTS-a $attachment " + done + + echo + + # 读取完整的邮件正文 + echo "Enter message. To mark the end of message type ;; in new line." + read line + + while [ "$line" != ";;" ] + do + BODY="$BODY$line\n" + read line + done + + SENDMAILCMD="mutt -e \"set from=$FROM\" -s \"$SUBJECT\" \ + $ATTACHMENTS -- \"$TO\" <<< \"$BODY\"" + echo $SENDMAILCMD + + mutt -e "set from=$FROM" -s "$SUBJECT" $ATTACHMENTS -- $TO <<< $BODY + +** 脚本输出 ** + + $ bash send_mail.sh + ********************* + E-mail sending script. + ********************* + + Enter the e-mail address you wish to send mail from: + [Enter] test@gmail.com + + Enter the e-mail address you wish to send mail to: + [Enter] test@gmail.com + + Enter e-mail subject: + [Enter] Message subject + + Provide the list of attachments. Separate names by space. + If there are spaces in file name, quote file name with ". + send_mail.sh + + Attachments: send_mail.sh + + Enter message. To mark the end of message type ;; in new line. + This is a message + text + ;; + +### 总结 ### + +有很多方法可以使用命令行/Shell脚本来发送邮件,我们只分享了其中4个类Unix系统可用的工具。希望你喜欢我们的文章,并且提供您的宝贵意见,让我们知道您想了解哪些新工具。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-shell-script/send-email-subject-body-attachment-linux/ + +作者:[Bobbin Zachariah][a] +译者:[goreliu](https://github.com/goreliu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bobbin/ \ No newline at end of file From cc999458e61e54c9da842a7040f089b9bd43391a Mon Sep 17 00:00:00 2001 From: Gore Liu Date: Wed, 20 May 2015 18:37:13 +0800 Subject: [PATCH 4/9] [Translating] 20150326 How to set up server monitoring system with Monit.md --- ...50326 How to set up server monitoring system with Monit.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150326 How to set up server monitoring system with Monit.md b/sources/tech/20150326 How to set up server monitoring system with Monit.md index c8f9efaecd..a803878b39 100644 --- a/sources/tech/20150326 How to set up server monitoring system with Monit.md +++ b/sources/tech/20150326 How to set up server monitoring system with Monit.md @@ -1,3 +1,5 @@ +Translating by goreliu ... + How to set up server monitoring system with Monit ================================================================================ Many Linux admins rely on a centralized remote monitoring system (e.g., [Nagios][1] or [Cacti][2]) to check the health of their network infrastructure. While centralized monitoring makes an admin's life easy when dealing with many hosts and devices, a dedicated monitoring box obviously becomes a single point of failure; if the monitoring box goes down or becomes unreachable for whatever reason (e.g., bad hardware or network outage), you will lose visibility on your entire infrastructure. @@ -237,7 +239,7 @@ In this tutorial, I demonstrate how to set up Monit on a local server. What I sh via: http://xmodulo.com/server-monitoring-system-monit.html 作者:[Iulian Murgulet][a] -译者:[译者ID](https://github.com/译者ID) +译者:[goreliu](https://github.com/goreliu) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From 3797ef5f4fc973220f9f83946e0b38c1165ba82a Mon Sep 17 00:00:00 2001 From: wwy-hust Date: Wed, 20 May 2015 22:45:41 +0800 Subject: [PATCH 5/9] after translation --- ...epositories Using Gitblit Tool in Linux.md | 101 ------------------ ...epositories Using Gitblit Tool in Linux.md | 101 ++++++++++++++++++ 2 files changed, 101 insertions(+), 101 deletions(-) delete mode 100644 sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md create mode 100644 translated/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md diff --git a/sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md b/sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md deleted file mode 100644 index 806a462675..0000000000 --- a/sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md +++ /dev/null @@ -1,101 +0,0 @@ -How to Serve Git Repositories Using Gitblit Tool in Linux -================================================================================ -Hi friends, today we'll be learning how to install Gitblit in your Linux Server or PC. So, lets check out what is a Git, its features and steps to install Gitblit. [Git is a distributed revision control system][1] with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. It was initially designed and developed by Linus Torvalds for Linux kernel under the terms of the GNU General Public License version 2 development in 2005, and has since become the most widely adopted version control system for software development. - -[Gitblit is a free and open source][2] built on a pure Java stack designed to handle everything from small to very large projects with speed and efficiency for serving Git repositories. It is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows. - -#### Features of Gitblit #### - -- It can be used as a dumb repository viewer with no administrative controls or user accounts. -- It can be used as a complete Git stack for cloning, pushing, and repository access control. -- It can be used without any other Git tooling (including actual Git) or it can cooperate with your established tools. - -### 1. Creating Gitblit install directory ### - -First of all we'll gonna to create a directory in our server in which we'll be installing our latest gitblit in. - - $ sudo mkdir -p /opt/gitblit - - $ cd /opt/gitblit - -![creating directory gitblit](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png) - -### 2. Downloading and Extracting ### - -Now, we will want to download the latest gitblit from the official site. Here, the current version of gitblit we are gonna install is 1.6.2 . So, please change it as the version you are gonna install in your system. - - $ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz - -![downloading gitblit package](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png) - -Now, we'll be extracting our downloaded tarball package to our current folder ie /opt/gitblit/ - - $ sudo tar -zxvf gitblit-1.6.2.tar.gz - -![extracting gitblit tar](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png) - -### 3. Configuring and Running ### - -Now, we'll configure our Gitblit configuration. If you want to customize the behavior of Gitblit server, you can do it by modifying `gitblit/data/gitblit.properties` . Now, after you are done configuring the configuration. We finally wanna run our gitblit. We have two options on running gitblit, first is that we run it manually by the command below: - - $ sudo java -jar gitblit.jar --baseFolder data - -And next is to add and use gitblit as service. Here are the steps that we'll need to follow to use gitblit as service in linux. - -So, As I am running Ubuntu, the command below will be sudo cp service-ubuntu.sh /etc/init.d/gitblit so please change the file name service-ubuntu.sh to the distribution you are currently running. - - $ sudo ./install-service-ubuntu.sh - - $ sudo service gitblit start - -![starting gitblit service](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png) - -Open your browser to http://localhost:8080 or https://localhost:8443 or replace "localhost" with the ip-address of the machine depending on your system configuration. Enter the default administrator credentials: admin / admin and click the Login button. - -![gitblit welcome](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png) - -Now, we'll wanna add a new user. First you'll need to login to the admin with default administrator credentials: username = **admin** and password = **admin** . - -Then, Goto user icon > users > (+) new user. And create a new user like as shown in the figure below. - -![add new user](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png) - -Now, we'll create a new repo out of the box. Go to repositories > (+) new repository . Then, add new repository as shown below. - -![add new repository](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png) - -#### Create a new repository on the command-line #### - - touch README.md - git init - git add README.md - git commit -m "first commit" - git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git - git push -u origin master - -Please replace the username arunlinoxide with the user you add. - -#### Push an existing repository from the command-line #### - - git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git - git push -u origin master - -**Note**: It is highly recommended to everyone to change the password of username "admin" as it comes by default. - -### Conclusion ### - -Hurray, we finally installed our latest Gitblit in our Linux Computer. We can now enjoy such a beautiful version controlling system for our projects whether its small or large, no matter. With Gitblit, version controlling has been too easy. It is easy to learn and has a tiny footprint with lightning fast performance. So, if you have any questions, suggestions, feedback please write them in the comment box below. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:http://git-scm.com/ -[2]:http://gitblit.com/ \ No newline at end of file diff --git a/translated/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md b/translated/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md new file mode 100644 index 0000000000..45c09f3475 --- /dev/null +++ b/translated/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md @@ -0,0 +1,101 @@ +如何在Linux下使用Gitblit工具创建Git仓库服务 +================================================================================ +嗨!朋友,今天我们将学习如何在你的Linux服务器或者PC上安装Gitblit工具。首先,我们看看什么是Git,它的功能以及安装Gitblit的步骤。[Git是分布式版本控制系统][1],它强调速度、数据一致性,并且支持分布式、非线性工作流。它最初由Linus Torvalds在2005年为Linux内核设计和开发,使用GPL2证书,并因此成为软件开发中使用最广泛的版本控制系统。 + +[Gitblit是完全开源的软件][2],它基于纯粹的Java堆栈,被设计以在Git仓库速度和效率方面胜任从小型到极大型的项目。它很容易学习和上手,并有着闪电般的性能。它在廉价的本地分支、便于staging、多工作流等方面远胜过一些SCM(版本控制)工具,比如Subversion、CVS、Perforce和ClearCase。 + +#### Gitblit的功能 #### + +- 它可以做为一个无声的仓库视图,没有管理控制以及用户账户。 +- 它可以做为完整的Git堆栈,拥有clone, pushing和仓库存取控制。 +- 它能独立于其他Git工具使用(包括实际的Git),它能和您已创建的工具合作。 + +### 1.创建Gitblit安装目录 ### + +首先我们将在我们的服务器上建立一个目录,我们将在该目录下安装最新的Gitblit。 + + $ sudo mkdir -p /opt/gitblit + + $ cd /opt/gitblit + +![创建gitblit目录](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png) + +### 2. 下载并解压 ### + +现在,我们将从Gitblit官方站点下载最新版的Gitblit。这里我们将安装1.6.2版本。所以,请在安装时根据具体的版本对命令进行修改。 + + $ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz + +![下载gitblit安装包](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png) + +接下来,我们将解压下载到的tarball压缩包至之前创建的目录 /opt/gitblit/ + + $ sudo tar -zxvf gitblit-1.6.2.tar.gz + +![解压gitblit压缩包](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png) + +### 3.配置并运行 ### + +现在,我们将对Gitblit进行配置。如果你想要定制Gitblit的行为,你可以修改`gitblit/data/gitblit.properties`。在完成配置后,我们将运行安装好的gitblit。有两种方式来运行gitblit,第一种是通过下面的命令手动运行: + + $ sudo java -jar gitblit.jar --baseFolder data + +另一种是将gitblit添加为服务。下面是在linux下将gitblit添加为服务的步骤。 + +由于我在使用Ubuntu,下面的命令将是 sudo cp service-ubuntu.sh /etc/init.d/gitblit。所以请根据你的发行版修改文件名service-ubuntu.sh为相应的你运行的发行版。 + + $ sudo ./install-service-ubuntu.sh + + $ sudo service gitblit start + +![启动gitblit服务](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png) + +在你的浏览器中打开http://localhost:8080或https://localhost:8443,也可以将localhost根据本地配置替换为IP地址。输入默认的管理员凭证:admin/admin并点击login按钮。 + +![gitblit欢迎页面](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png) + +现在,我们将添加一个新的用户。首先,你需要以admin用户登录,username = **admin**,password = **admin**。 + +然后,点击 user icon > users > (+) new user 来创建一个新用户,如下图所示。 + +![添加新用户](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png) + +现在,我们将创建一个开箱可用的仓库。点击 repositories > (+) new repository。然后,如下图所示添加新的仓库。 + +![添加新的仓库](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png) + +#### 使用命令行创建一个新的仓库 #### + + touch README.md + git init + git add README.md + git commit -m "first commit" + git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git + git push -u origin master + +请将用户名arunlinoxide替换为你添加的用户名。 + +#### 在命令行中push一个已存在的仓库 #### + + git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git + git push -u origin master + +**注意**:强烈建议所有人修改用户名“admin”的密码。 + +### 结论 ### + +欢呼吧!我们已经在Linux电脑中安装好了最新版本的Gitblit。接下来我们便可以在我们的大小工程中享受这样一个优美的版本控制系统。有了Gitblit,版本控制便再容易不过了。它有易于学习、轻量级、高性能的特点。因此,如果你有任何的问题、建议和反馈,请在留言处留言。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/ + +作者:[Arun Pyasi][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://git-scm.com/ +[2]:http://gitblit.com/ \ No newline at end of file From f2be3eca0187b39b285eed0f1cb7cd2873bb210e Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 20 May 2015 23:15:23 +0800 Subject: [PATCH 6/9] PUB:20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux @geekpi --- ...s--How to change PATH environment variable on Linux.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md (90%) diff --git a/translated/tech/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md b/published/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md similarity index 90% rename from translated/tech/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md rename to published/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md index 5cc7a17bd2..321ce4b2d3 100644 --- a/translated/tech/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md +++ b/published/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md @@ -1,4 +1,4 @@ -Linux有问必答--如何在Linux中修改环境变量PATH +Linux有问必答:如何在Linux中修改环境变量PATH ================================================================================ > **提问**: 当我试着运行一个程序时,它提示“command not found”。 但这个程序就在/usr/local/bin下。我该如何添加/usr/local/bin到我的PATH变量下,这样我就可以不用指定路径来运行这个命令了。 @@ -38,7 +38,7 @@ Linux有问必答--如何在Linux中修改环境变量PATH /usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/sbin:/sbin:/home/xmodulo/bin:/usr/local/bin -更新的PATH会在当前的PATH一直有效。然而,更改将在新的会话中失效。 +更新后的PATH会在当前的会话一直有效。然而,更改将在新的会话中失效。 如果你想要永久更改PATH变量,用编辑器打开~/.bashrc (或者 ~/.bash_profile),接着在最后添加下面这行。 @@ -46,7 +46,7 @@ Linux有问必答--如何在Linux中修改环境变量PATH 接着运行下面这行永久激活更改: - $ source ~/.bashrc (or source ~/.bash_profile) + $ source ~/.bashrc (或者 source ~/.bash_profile) ### 改变系统级的环境变量 ### @@ -66,7 +66,7 @@ via: http://ask.xmodulo.com/change-path-environment-variable-linux.html 作者:[Dan Nanni][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From 522b7ea44009d0dc4aaa902e7f1b7e1aaac2b065 Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 20 May 2015 23:37:30 +0800 Subject: [PATCH 7/9] PUB:20150410 What is a good alternative to wget or curl on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wangjiezhe 翻译的不错! --- ...od alternative to wget or curl on Linux.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) rename {translated/tech => published}/20150410 What is a good alternative to wget or curl on Linux.md (71%) diff --git a/translated/tech/20150410 What is a good alternative to wget or curl on Linux.md b/published/20150410 What is a good alternative to wget or curl on Linux.md similarity index 71% rename from translated/tech/20150410 What is a good alternative to wget or curl on Linux.md rename to published/20150410 What is a good alternative to wget or curl on Linux.md index caa4010661..3af223b631 100644 --- a/translated/tech/20150410 What is a good alternative to wget or curl on Linux.md +++ b/published/20150410 What is a good alternative to wget or curl on Linux.md @@ -1,12 +1,13 @@ -Linux 上 wget 或 curl 的更佳替代品 +用腻了 wget 或 curl,有什么更好的替代品吗? ================================================================================ -如果你经常需要通过终端以非交互模式访问网络服务器(例如,从网络上下载文件,或者是测试 RESTful 网络服务接口),可能你会选择的工具是 wget 或 curl。通过大量的命令行选项,这两种工具都可以处理很多非交互网络访问的情况(比如[这里][1],[这里][2],还有[这里][3])。然而,即使像这些一样的强大的工具,也只是与你对如何使用它们的了解程度等同。除非你很精通那些又多又笨(原文是 nitty and gritty)的语法细节,这些工具对于你来说只不过是简单的网络下载器。 -就像宣传的那样,“为人类着想的类 curl 工具”,[HTTPie][4] 设计用来增强 wget 和 curl 的可用性。它的主要目标是使通过命令行与网络服务器进行交互的过程变得尽可能的人性化。为此,HTTPie 支持具有表现力,但又很简单很直观的语法。它以彩色模式显示响应,并且还有一些不错的优点,比如对 JSON 的良好支持,和持久性会话用以作业流程化。 +如果你经常需要通过终端以非交互模式访问网络服务器(例如,从网络上下载文件,或者是测试 RESTful 网络服务接口),可能你会选择的工具是 wget 或 curl。通过大量的命令行选项,这两种工具都可以处理很多非交互网络访问的情况(比如[这里][1]、[这里][2],还有[这里][3])。然而,即使像这些一样的强大的工具,你也只能发挥你所了解的那些选项的功能。除非你很精通那些繁冗的语法细节,这些工具对于你来说只不过是简单的网络下载器而已。 -我知道很多人对把像 wget 和 curl 这样的无处不在的可用的完美工具换成完全没听说过的软件心存怀疑。这种观点是好的,特别是如果你是一个系统管理员、要处理很多不同的硬件的话。然而,对于开发者和终端用户来说,重要的是效率。如果我发现了一个工具的用户友好替代,我没有看到任何问题如果你采用易于使用的版本来节省你宝贵的时间。没有必要对替换掉的工具保持信仰忠诚。毕竟,对于 Linux 来说,最好的事情是可以选择。 +就像其宣传的那样,“给人用 curl 类工具”,[HTTPie][4] 设计用来增强 wget 和 curl 的可用性。它的主要目标是使通过命令行与网络服务器进行交互的过程变得尽可能的人性化。为此,HTTPie 支持具有表现力、但又很简单很直观的语法。它以彩色模式显示响应,并且还有一些不错的优点,比如对 JSON 的良好支持,和持久性会话用以作业流程化。 -在这篇文章中,让我们来回顾并展示一下我所说的 HTTPie,一个用户友好的 wget 和 curl 的替代。 +我知道很多人对把像 wget 和 curl 这样的无处不在的、可用的、完美的工具换成完全没听说过的软件心存疑虑。这种观点是好的,特别是如果你是一个系统管理员、要处理很多不同的硬件的话。然而,对于开发者和终端用户来说,重要的是效率。如果我发现了一个工具的用户更佳替代品,那么我认为采用易于使用的版本来节省宝贵的时间是毫无疑问的。没有必要对替换掉的工具保持信仰忠诚。毕竟,对于 Linux 来说,最好的事情就是可以选择。 + +在这篇文章中,让我们来了解并展示一下我所说的 HTTPie,一个用户友好的 wget 和 curl 的替代。 ![](https://farm8.staticflickr.com/7633/16849137018_bcc7a616fc_b.jpg) @@ -40,10 +41,9 @@ HTTPie 是用 Python 写的,所以你可以在几乎所有地方(Linux,Mac 你可以使用 <header:value> 的格式来定制头部。例如,我们发送一个 HTTP GET 请求到 www.test.com ,使用定制用户代理(user-agent)和来源(referer),还有定制头部(比如 MyParam)。 - $ http www.test.com User-Agent:Xmodulo/1.0 Referer:http://xmodulo.com MyParam:Foo -注意到当使用 HTTP GET 方法时,你无需指定任何 HTTP 方法。 +注意到当使用 HTTP GET 方法时,就无需明确指定 HTTP 方法。 这个 HTTP 请求看起来如下: @@ -121,7 +121,7 @@ HTTPie 的另外一个用户友好特性是输入重定向,你可以使用缓 ### 结束语 ### -在这篇文章中,我介绍了 HTTPie,一个 wget 和 curl 的可能替代工具。除了这里展示的几个简单的例子,你可以在[官方网站][7]上找到 HTTPie 的很多有趣的应用。再次重复一遍,一款强大的工具也只相当于你对它的了解程度。从个人而言,我更热衷于 HTTPie,因为我在寻找一种更简洁的测试复杂网络接口的方法。 +在这篇文章中,我介绍了 HTTPie,一个 wget 和 curl 的可能替代工具。除了这里展示的几个简单的例子,你可以在其[官方网站][7]上找到 HTTPie 的很多有趣的应用。再次重复一遍,一款再强大的工具也取决于你对它的了解程度。从个人而言,我更倾向于 HTTPie,因为我在寻找一种更简洁的测试复杂网络接口的方法。 你怎么看? @@ -131,15 +131,15 @@ via: http://xmodulo.com/wget-curl-alternative-linux.html 作者:[Dan Nanni][a] 译者:[wangjiezhe](https://github.com/wangjiezhe) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://xmodulo.com/author/nanni [1]:http://xmodulo.com/how-to-download-multiple-files-with-wget.html [2]:http://xmodulo.com/how-to-use-custom-http-headers-with-wget.html -[3]:http://ask.xmodulo.com/custom-http-header-curl.html +[3]:https://linux.cn/article-4957-1.html [4]:https://github.com/jakubroztocil/httpie -[5]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html +[5]:https://linux.cn/article-2324-1.html [6]:http://ask.xmodulo.com/install-pip-linux.html [7]:https://github.com/jakubroztocil/httpie From 08e9d737523c4ef03255fcc7607cef2addaf0dd1 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 21 May 2015 00:04:24 +0800 Subject: [PATCH 8/9] PUB:20150409 Install Inkscape - Open Source Vector Graphic Editor @ZTinoZ --- ...ape - Open Source Vector Graphic Editor.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) rename {translated/tech => published}/20150409 Install Inkscape - Open Source Vector Graphic Editor.md (62%) diff --git a/translated/tech/20150409 Install Inkscape - Open Source Vector Graphic Editor.md b/published/20150409 Install Inkscape - Open Source Vector Graphic Editor.md similarity index 62% rename from translated/tech/20150409 Install Inkscape - Open Source Vector Graphic Editor.md rename to published/20150409 Install Inkscape - Open Source Vector Graphic Editor.md index f18b10315e..c6361e780b 100644 --- a/translated/tech/20150409 Install Inkscape - Open Source Vector Graphic Editor.md +++ b/published/20150409 Install Inkscape - Open Source Vector Graphic Editor.md @@ -1,8 +1,8 @@ -安装Inkscape - 开源适量图形编辑器 +Inkscape - 开源适量图形编辑器 ================================================================================ -Inkscape是一款开源矢量图形编辑工具,它使用可缩放矢量图形(SVG)图形格式并不同于它的竞争对手如Xara X、Corel Draw和Adobe Illustrator等等。SVG是一个广泛部署、免版税使用的图形格式,由W3C SVG工作组开发和维护。这是一个跨平台工具,完美运行于Linux、Windows和Mac OS上。 +Inkscape是一款开源矢量图形编辑工具,并不同于Xara X、Corel Draw和Adobe Illustrator等竞争对手,它使用的是可缩放矢量图形(SVG)图形格式。SVG是一个广泛部署、免版税使用的图形格式,由W3C SVG工作组开发和维护。这是一个跨平台工具,完美运行于Linux、Windows和Mac OS上。 -Inkscape始于2003年,起初它的bug跟踪系统托管于Sourceforge上但是 后来迁移到了Launchpad上。当前它最新的一个稳定版本是0.91,它不断地在发展和修改中。我们将在本文里了解一下它的突出特点和安装过程。 +Inkscape始于2003年,起初它的bug跟踪系统托管于Sourceforge上,但是后来迁移到了Launchpad上。当前它最新的一个稳定版本是0.91,它不断地在发展和修改中。我们将在本文里了解一下它的突出特点和安装过程。 ### 显著特性 ### @@ -12,30 +12,30 @@ Inkscape始于2003年,起初它的bug跟踪系统托管于Sourceforge上但是 - 用铅笔工具来画出不同颜色、大小和形状的手绘线,用贝塞尔曲线(笔式)工具来画出直线和曲线,通过书法工具来应用到手写的书法笔画上等等 - 用文本工具来创建、选择、编辑和格式化文本。在纯文本框、在路径上或在形状里操作文本 -- 有效绘制各种形状,像矩形、椭圆形、圆形、弧线、多边形、星形和螺旋形等等并调整其大小、旋转并修改(圆角化)它们 +- 方便绘制各种形状,像矩形、椭圆形、圆形、弧线、多边形、星形和螺旋形等等并调整其大小、旋转并修改(圆角化)它们 - 用简单地命令创建并嵌入位图 #### 对象处理 #### -- 通过交互式操作和调整数值来扭曲、移动、测量、旋转目标 -- 执行力提升并减少了Z-order操作。 -- 对象群组化或取消群组化可以去创建一个虚拟层阶用来编辑或处理 -- 图层采用层次结构树的结构并且能锁定或以各式各样的处理方式来重新布置 +- 通过交互式操作和调整参量来扭曲、移动、测量、旋转目标 +- 可以对 Z 轴进行提升或降低操作。 +- 通过对象组合和取消组合可以创建一个虚拟层用来编辑或处理 +- 图层采用层次结构树的结构,并且能锁定或以各式各样的处理方式来重新布置 - 分布与对齐指令 #### 填充与边框 #### -- 复制/粘贴风格 +- 可以复制/粘贴不同风格 - 取色工具 - 用RGB, HSL, CMS, CMYK和色盘这四种不同的方式选色 -- 渐层编辑器能创建和管理多停点渐层 -- 定义一个图像或其它选择用来进行花纹填充 -- 用一些预定义泼洒花纹可对边框进行花纹泼洒 -- 通过路径标示器来开始、对折和结束标示 +- 渐变层编辑器能创建和管理多停点渐变层 +- 使用图像或其它选择区作为花纹填充 +- 用一些预定义点状花纹进行笔触填充 +- 通过路径标示器标示开始、对折和结束点 #### 路径上的操作 #### -- 节点编辑:移动节点和贝塞尔曲线掌控,节点的对齐和分布等等 +- 节点编辑:移动节点和贝塞尔曲线控制点,节点的对齐和分布等等 - 布尔运算(是或否) - 运用可变的路径起迄点可简化路径 - 路径插入和增设连同动态和链接偏移对象 @@ -43,9 +43,9 @@ Inkscape始于2003年,起初它的bug跟踪系统托管于Sourceforge上但是 #### 文本处理 #### -- 所有安装好的外框字体都能用甚至可以从右至左对齐对象 +- 所有安装好的框线字体都能用,甚至可以从右至左对齐对象 - 格式化文本、调整字母间距、行间距或列间距 -- 路径上的文本和形状上的文本和路径或形状都可以被编辑和修改 +- 路径上和形状上的文本中的文本、路径或形状都可以被编辑和修改 #### 渲染 #### @@ -78,7 +78,7 @@ PPA添加到APT库中后,我们要用以下命令进行更新: ### 结论 ### -Inkscape是一款特点鲜明的图形编辑工具,它给予用户充分发挥自己艺术力的权利。它还是一款自由安装和自定义开源应用并且支持大范围文件类型包括JPEG, PNG, GIF和PDF且不仅这些。访问它的 [官方网站][2] 来获取更多新闻和应用更新。 +Inkscape是一款特点鲜明的图形编辑工具,它给予用户充分发挥自己艺术能力的权利。它还是一款自由安装和自定义的开源应用,并且支持各种文件类型,包括JPEG, PNG, GIF和PDF及更多。访问它的 [官方网站][2] 来获取更多新闻和应用更新。 -------------------------------------------------------------------------------- @@ -86,7 +86,7 @@ via: http://linoxide.com/tools/install-inkscape-open-source-vector-graphic-edito 作者:[Aun Raza][a] 译者:[ZTinoZ](https://github.com/ZTinoZ) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From f59deb250e4e8212c0ab45e7233623a3c5cdecc0 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 21 May 2015 00:08:10 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Your Network And Servers With Observium.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 published/20150304 Monitoring Your Network And Servers With Observium.md diff --git a/published/20150304 Monitoring Your Network And Servers With Observium.md b/published/20150304 Monitoring Your Network And Servers With Observium.md new file mode 100644 index 0000000000..14fc41b746 --- /dev/null +++ b/published/20150304 Monitoring Your Network And Servers With Observium.md @@ -0,0 +1,174 @@ +使用Observium来监控你的网络和服务器 +================================================================================ +### 简介### + +在监控你的服务器、交换机或者设备时遇到过问题吗?**Observium** 可以满足你的需求。这是一个免费的监控系统,它可以帮助你远程监控你的服务器。它是一个由PHP编写的基于自动发现 SNMP 的网络监控平台,支持非常广泛的网络硬件和操作系统,包括 Cisco、Windows、Linux、HP、NetApp 等等。在此我会给出在 Ubuntu 12.04 上一步步地设置一个 **Observium** 服务器的介绍。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/Capture1.png) + +目前有两种不同的 **observium** 版本。 + +- Observium 社区版本是一个在 QPL 开源许可证下的免费工具,这个版本是对于较小部署的最好解决方案。该版本每6个月进行一次安全性更新。 +- 第2个版本是 Observium 专业版,该版本采用基于 SVN 的发布机制。 会得到每日安全性更新。 该工具适用于服务提供商和企业级部署。 + +更多信息可以通过其[官网][1]获得。 + +### 系统需求### + +要安装 **Observium**, 需要具有一个最新安装的服务器。**Observium** 是在 Ubuntu LTS 和 Debian 系统上进行开发的,所以推荐在 Ubuntu 或 Debian 上安装 **Observium**,因为可能在别的平台上会有一些小问题。 + +该文章会引导你在 Ubuntu 12.04 上安装 **Observium**。对于小型的 **Observium** 安装,建议使用 256MB 内存和双核处理器的配置。 + +### 安装需求 ### + +在安装 **Observuim** 之前,你需要确认安装所有的依赖关系包。 + +首先,使用下面的命令更新你的服务器: + + sudo apt-get update + +然后你需要安装下列运行 Observuim 所需的全部软件包。 + +Observium 需要使用下面所列出的软件才能正确的运行: + +- LAMP 服务器 +- fping +- Net-SNMP 5.4+ +- RRDtool 1.3+ +- Graphviz + +对于可选特性的要求: + +- Ipmitool - 仅在当你想要获取服务器上的 IPMI(Intelligent Platform Management Interface 智能平台管理接口)基板控制器时。 +- Libvirt-bin - 仅在当你想要使用 libvirt 进行远程 VM 主机监控时。 + + sudo apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-mcrypt php5-json php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick libvirt ipmitool + +### 为 Observium 创建 MySQL 数据库及其用户。 + +现在你需要登录到 MySQL 中并为 **Observium** 创建数据库: + + mysql -u root -p + +在用户验证成功之后,你需要按照下面的命令创建该数据库。 + + CREATE DATABASE observium; + +数据库名为 **Observium**,稍后你会需要这个信息。 + +现在你需要创建数据库管理员用户。 + + CREATE USER observiumadmin@localhost IDENTIFIED BY 'observiumpassword'; + +接下来,你需要给该管理员用户相应的权限来管理创建的数据库。 + + GRANT ALL PRIVILEGES ON observium.* TO observiumadmin@localhost; + +你需要将权限信息写回到磁盘中来激活新的 MySQL 用户: + + FLUSH PRIVILEGES; + exit + +### 下载并安装 Observium### + +现在我们的系统已经准备好了, 可以开始Observium的安装了。 + +第一步,创建 Observium 将要使用的文件目录: + + mkdir -p /opt/observium && cd /opt + +按本教程的目的,我们将会使用 Observium 的社区/开源版本。使用下面的命令下载并解压: + + wget http://www.observium.org/observium-community-latest.tar.gz + tar zxvf observium-community-latest.tar.gz + +现在进入到 Observium 目录。 + + cd observium + +将默认的配置文件 '**config.php.default**' 复制到 '**config.php**',并将数据库配置选项填充到配置文件中: + + cp config.php.default config.php + nano config.php + +---------- + + / Database config + $config['db_host'] = 'localhost'; + $config['db_user'] = 'observiumadmin'; + $config['db_pass'] = 'observiumpassword'; + $config['db_name'] = 'observium'; + +现在为 MySQL 数据库设置默认的数据库模式: + + php includes/update/update.php + +现在你需要创建一个文件目录来存储 rrd 文件,并修改其权限以便让 apache 能将写入到文件中。 + + mkdir rrd + chown apache:apache rrd + +为了在出现问题时排错,你需要创建日志文件。 + + mkdir -p /var/log/observium + chown apache:apache /var/log/observium + +现在你需要为 Observium 创建虚拟主机配置。 + + + DocumentRoot /opt/observium/html/ + ServerName observium.domain.com + CustomLog /var/log/observium/access_log combined + ErrorLog /var/log/observium/error_log + + AllowOverride All + Options FollowSymLinks MultiViews + + + +下一步你需要让你的 Apache 服务器的 rewrite (重写)功能生效。 + +为了让 'mod_rewrite' 生效,输入以下命令: + + sudo a2enmod rewrite + +该模块在下一次 Apache 服务重启之后就会生效。 + + sudo service apache2 restart + +###配置 Observium### + +在登入 Web 界面之前,你需要为 Observium 创建一个管理员账户(级别10)。 + + # cd /opt/observium + # ./adduser.php admin adminpassword 10 + User admin added successfully. + +下一步为发现和探寻任务设置一个 cron 任务,创建一个新的文件 ‘**/etc/cron.d/observium**’ 并在其中添加以下的内容。 + + 33 */6 * * * root /opt/observium/discovery.php -h all >> /dev/null 2>&1 + */5 * * * * root /opt/observium/discovery.php -h new >> /dev/null 2>&1 + */5 * * * * root /opt/observium/poller-wrapper.py 1 >> /dev/null 2>&1 + +重载 cron 进程来增加新的任务。 + + # /etc/init.d/cron reload + +好啦,你已经完成了 Observium 服务器的安装拉! 使用你的浏览器登录到 **http://\**,然后上路吧。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/Capture.png) + +尽情享受吧! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/monitoring-network-servers-observium/ + +作者:[anismaj][a] +译者:[theo-l](http://github.com/theo-l) +校对:[wxy](http://github.com/wxy) + +本文由 [LCTT](http://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/anis/ +[1]:http://www.observium.org/