From cc063420fe3107398e633f67f0182f2e925695a9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 5 Dec 2014 09:45:42 -0500 Subject: [PATCH 1/7] translated --- ...work Adapters Available In Ubuntu Linux.md | 102 ------------------ 1 file changed, 102 deletions(-) delete mode 100644 sources/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md diff --git a/sources/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md b/sources/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md deleted file mode 100644 index 2a6dfcaeb7..0000000000 --- a/sources/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md +++ /dev/null @@ -1,102 +0,0 @@ -Translating----geekpi - -Find Out Network Adapters Available In Ubuntu Linux -================================================================================ -Wondering **which network adapters you are using in Ubuntu or any other Linux OS**? It is very easy to to find out the manufacturer of the network adapters in your computer in Linux. Open a terminal and use the following command: - - sudo lshw -C network - -If the above command doesn’t work with sudo, remove the super user privileges. Weird but helps. The output of the command reads like this: - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/Network_Adapter_Linux.jpeg) - -> *-network -> -> description: Wireless interface -> -> product: BCM4360 802.11ac Wireless Network Adapter -> -> vendor: Broadcom Corporation -> -> physical id: 0 -> -> bus info: pci@0000:03:00.0 -> -> logical name: wlan0 -> -> version: 03 -> -> serial: 9c:f3:87:c1:5d:6a -> -> width: 64 bits -> -> clock: 33MHz -> -> capabilities: bus_master cap_list ethernet physical wireless -> -> configuration: broadcast=yes driver=wl0 driverversion=6.30.223.248 (r487574) ip=192.168.1.23 latency=0 multicast=yes wireless=IEEE 802.11abg -> -> resources: irq:18 memory:b0600000-b0607fff memory:b0400000-b05fffff - -As you can see, the wireless network adapter in my Macbook Air is BCM4360, a troublesome wireless adapter because of which often Ubuntu does not detect wireless networks. - -[lshw][1] command actually used to list hardware and hence the command is named lshw. With the option network, it filters the result for networking hardware only. - -### Alternate method to know the network adapter ### - -Alternatively, you can use lspci command that displays the information about PCI buses in the system. You should not need super user privileges to use this command. Just type the command in terminal: - - lspci - -The output of the command reads as: - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/Network_Adapter_Linux_1.jpeg) - -> 00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09) -> -> 00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09) -> -> 00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09) -> -> 00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04) -> -> 00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04) -> -> 00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04) -> -> 00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 1 (rev e4) -> -> 00:1c.1 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 2 (rev e4) -> -> 00:1c.2 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4) -> -> 00:1c.4 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 5 (rev e4) -> -> 00:1c.5 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 6 (rev e4) -> -> 00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04) -> -> 00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04) -> -> 02:00.0 Multimedia controller: Broadcom Corporation Device 1570 -> -> 03:00.0 Network controller: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter (rev 03) -> -> 04:00.0 SATA controller: Marvell Technology Group Ltd. 88SS9183 PCIe SSD Controller (rev 14) - -These command gives you information about both wired and wireless network adapters. You might have noticed that there is no wired network adapter for my system in the output above. The reason is that I am using a Macbook Air and it does not have an Ethernet port. - -I hope this quick post helped you to find the network adapters in your Linux system. Any questions or suggestions are always welcomed. - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/find-network-adapter-ubuntu-linux/ - -作者:[Abhishek][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/Abhishek/ -[1]:http://linux.die.net/man/1/lshw From 0c2eb305197a2adeaa7d51313f3af2024b32ec10 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 5 Dec 2014 09:49:22 -0500 Subject: [PATCH 2/7] translated --- ...work Adapters Available In Ubuntu Linux.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 translated/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md diff --git a/translated/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md b/translated/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md new file mode 100644 index 0000000000..d20083a363 --- /dev/null +++ b/translated/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md @@ -0,0 +1,100 @@ +在Ubuntu上找出可用的网络适配器 +================================================================================ +想知道**在Linux中你正在使用的网卡是什么吗?** 在Linux中很容易就找出网卡的生产商。打开一个终端并输入下面的额命令: + + sudo lshw -C network + +如果上面的命令不能在sudo下使用,那就移除sudo。它的输出看上去有点奇怪但是很有用。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/Network_Adapter_Linux.jpeg) + +> *-network +> +> description: Wireless interface +> +> product: BCM4360 802.11ac Wireless Network Adapter +> +> vendor: Broadcom Corporation +> +> physical id: 0 +> +> bus info: pci@0000:03:00.0 +> +> logical name: wlan0 +> +> version: 03 +> +> serial: 9c:f3:87:c1:5d:6a +> +> width: 64 bits +> +> clock: 33MHz +> +> capabilities: bus_master cap_list ethernet physical wireless +> +> configuration: broadcast=yes driver=wl0 driverversion=6.30.223.248 (r487574) ip=192.168.1.23 latency=0 multicast=yes wireless=IEEE 802.11abg +> +> resources: irq:18 memory:b0600000-b0607fff memory:b0400000-b05fffff + +如你所见,我Macbook Air上的无线网卡是BCM4360,这是一款在Ubuntu下面经常无法检测无线网络的很容易出问题的网卡。 + +[lshw][1] 命令实际上死用来列出硬件的,因此命令的名字是lshw。带上网络的选项后,就会只过滤出网络硬件了。 + +### 了解网卡的其他方法 ### + +另外你还可以使用lspci命令来显示PCI总线上的信息。你不应该用特权模式来运行这个命令。只需要在命令行下输入: + + lspci + +命令的输出看上去想这样: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/Network_Adapter_Linux_1.jpeg) + +> 00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09) +> +> 00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09) +> +> 00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09) +> +> 00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04) +> +> 00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04) +> +> 00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04) +> +> 00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 1 (rev e4) +> +> 00:1c.1 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 2 (rev e4) +> +> 00:1c.2 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4) +> +> 00:1c.4 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 5 (rev e4) +> +> 00:1c.5 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 6 (rev e4) +> +> 00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04) +> +> 00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04) +> +> 02:00.0 Multimedia controller: Broadcom Corporation Device 1570 +> +> 03:00.0 Network controller: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter (rev 03) +> +> 04:00.0 SATA controller: Marvell Technology Group Ltd. 88SS9183 PCIe SSD Controller (rev 14) + +这些命令会同时列出有线和无线的网卡。你应该注意到上面的输出中显示我的系统中没有有线网卡。因为我使用的是Macbook Air,他没有以太网端口 + +我希望这边文章可以帮助你找到你系统中的网卡。欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/find-network-adapter-ubuntu-linux/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/Abhishek/ +[1]:http://linux.die.net/man/1/lshw \ No newline at end of file From 8160d35495568a58f2e3d757ac2ecbb5236374c6 Mon Sep 17 00:00:00 2001 From: Vic___ Date: Fri, 5 Dec 2014 23:39:50 +0800 Subject: [PATCH 3/7] Translated --- ...atabase In Oracle 11 Without Using DBCA.md | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/sources/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md b/sources/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md index 0959fec604..03acaeff19 100644 --- a/sources/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md +++ b/sources/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md @@ -1,17 +1,18 @@ - Vic020 - -How To Drop Database In Oracle 11 Without Using DBCA +如何不使用DBCA在Oracle 11中删除数据库 ================================================================================ -In this small tutorial, I want to show you how to drop the database without using the GUI tool DBCA +本文简短的教程,将会向你展示如何不使用DBCA(数据库配置助手)在Oracle 11中删除数据 -#### 1- Export database SID if not yet Already defined #### +#### 1- 导入数据库的SID,如果没有定义的话 #### + 命令: export ORACLE_SID=database -#### 2- Connect as sysdba #### +#### 2- 以操作系统认证连接数据库 #### + 命令: [oracle@Oracle11 ~]$ sqlplus / as sysdba + 提示: ---------- SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 1 17:38:02 2014 @@ -24,9 +25,11 @@ In this small tutorial, I want to show you how to drop the database without usin Connected to an idle instance. -#### 3- Start The database #### +#### 3- 启动数据库实例 #### + 命令: SQL> startup + 提示: ORACLE instance started. Total System Global Area 3340451840 bytes Fixed Size 2217952 bytes @@ -36,16 +39,20 @@ In this small tutorial, I want to show you how to drop the database without usin Database mounted. Database opened. -#### 4- Shutdown the database #### +#### 4- 关闭数据库 #### + 命令: SQL> shutdown immediate; + 提示: Database closed. Database dismounted. ORACLE instance shut down. -#### 5- Start in Exclusive mode #### +#### 5- 启动独占模式 #### + 命令: SQL> startup mount exclusive restrict + 提示: ORACLE instance started. ---------- @@ -57,10 +64,12 @@ In this small tutorial, I want to show you how to drop the database without usin Redo Buffers 16343040 bytes Database mounted. -#### 6- Drop the database #### +#### 6- 删除数据库 #### + 命令: SQL> drop database; + 提示: ---------- Database dropped. @@ -71,14 +80,14 @@ In this small tutorial, I want to show you how to drop the database without usin With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> -Cheers! +完成! -------------------------------------------------------------------------------- via: http://www.unixmen.com/drop-database-oracle-11-without-using-dcba/ 作者:[M.el Khamlichi][a] -译者:[译者ID](https://github.com/译者ID) +译者:[VicYu/Vic020](http://vicyu.net/) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From d8a14e7733e99d7e58dcabdd735ce0dacdb726bd Mon Sep 17 00:00:00 2001 From: Vic___ Date: Fri, 5 Dec 2014 23:41:09 +0800 Subject: [PATCH 4/7] moved --- ...141204 How To Drop Database In Oracle 11 Without Using DBCA.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md (100%) diff --git a/sources/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md b/translated/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md similarity index 100% rename from sources/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md rename to translated/tech/20141204 How To Drop Database In Oracle 11 Without Using DBCA.md From 1e7168c4d96f933be8e59265153307decf0ebd58 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Fri, 5 Dec 2014 23:41:09 +0800 Subject: [PATCH 5/7] =?UTF-8?q?20141205-4=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e a syslog server with rsyslog on Linux.md | 154 +++++++++++ ...backup plan for Debian with backupninja.md | 247 ++++++++++++++++++ ...lotlib for scientific plotting on Linux.md | 152 +++++++++++ ...at is a good free control panel for VPS.md | 155 +++++++++++ 4 files changed, 708 insertions(+) create mode 100644 sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md create mode 100644 sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md create mode 100644 sources/tech/20141205 How to use matplotlib for scientific plotting on Linux.md create mode 100644 sources/tech/20141205 What is a good free control panel for VPS.md diff --git a/sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md b/sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md new file mode 100644 index 0000000000..276e5a05fa --- /dev/null +++ b/sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md @@ -0,0 +1,154 @@ +How to configure a syslog server with rsyslog on Linux +================================================================================ +A syslog server represents a central log monitoring point on a network, to which all kinds of devices including Linux or Windows servers, routers, switches or any other hosts can send their logs over network. By setting up a syslog server, you can filter and consolidate logs from different hosts and devices into a single location, so that you can view and archive important log messages more easily. + +On most Linux distributions, **rsyslog** is the standard syslog daemon that comes pre-installed. Configured in a client/server architecture, **rsyslog** can play both roles; as a syslog server **rsyslog** can gather logs from other devices, and as a syslog client, **rsyslog** can transmit its internal logs to a remote syslog server. + +In this tutorial, we cover how to configure a centralized syslog server using **rsyslog** on Linux. Before we go into the details, it is instructive to go over syslog standard first. + +### Basic of Syslog Standard ### + +When logs are collected with syslog mechanism, three important things must be taken into consideration: + +- **Facility level**: what type of processes to monitor +- **Severity (priority) level**: what type of log messages to collect +- **Destination**: where to send or record log messages + +Let's take a look at how the configuration is defined in more detail. + +The facility levels define a way to categorize internal system processes. Some of the common standard facilities in Linux are: + +- **auth**: messages related to authentication (login) +- **cron**: messages related to scheduled processes or applications +- **daemon**: messages related to daemons (internal servers) +- **kernel**: messages related to the kernel +- **mail**: messages related to internal mail servers +- **syslog**: messages related to the syslog daemon itself +- **lpr**: messages related to print servers +- **local0 - local7**: messages defined by user (local7 is usually used by Cisco and Windows servers) + +The severity (priority) levels are standardized, and defined by using standard abbreviation and an assigned number with number 7 being the highest level of all. These levels are: + +- emerg: Emergency - 0 +- alert: Alerts - 1 +- crit: Critical - 2 +- err: Errors - 3 +- warn: Warnings - 4 +- notice: Notification - 5 +- info: Information - 6 +- debug: Debugging - 7 + +Finally, the destination statement enforces a syslog client to perform one of three following tasks: (1) save log messages on a local file, (2) route them to a remote syslog server over TCP/UDP, or (3) send them to stdout such as a console. + +In rsyslog, syslog configuration is structured based on the following schema. + + [facility-level].[severity-level] [destination] + +### Configure Rsyslog on Linux ### + +Now that we understand syslog, it's time to configure a Linux server as a central syslog server using rsyslog. We will also see how to configure a Windows based system as a syslog client to send internal logs to the syslog server. + +#### Step One: Initial System Requirements #### + +To set up a Linux host as a central log server, we need to create a separate /var partition, and allocate a large enough disk size or create a LVM special volume group. That way, the syslog server will be able to sustain the exponential growth of collected logs over time. + +#### Step Two: Enable Rsyslog Daemon #### + +rsyslog daemon comes pre-installed on modern Linux distributions, but is not enabled by default. To enable rsyslog daemon to receive external messages, edit its configuration file located in /etc/rsyslog.conf. + +Once the file is opened for editing, search and uncomment the below two lines by removing the # sign from the beginning of lines. + + $ModLoad imudp + $UDPServerRun 514 + +This will enable rsyslog daemon to receive log messages on UDP port 514. UDP is way faster than TCP, but does not provide reliability on data flow the same way as TCP does. If you need to reliable delivery, you can enable TCP by uncommenting the following lines. + + $ModLoad imtcp + $InputTCPServerRun 514 + +Note that both TCP and UDP can be set on the server simultaneously to listen on TCP/UDP connections. + +#### Step Three: Create a Template for Log Receipt #### + +In the next step we need to create a template for remote messages, and tell rsyslog daemon how to record messages received from other client machines. + +Open /etc/rsyslog.conf with a text editor, and append the following template before the GLOBAL DIRECTIVES block: + + $template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log" * + *.* ?RemoteLogs + & ~ + +This template needs a little explanation. The $template RemoteLogs directive ("RemoteLogs" string can be changed to any other descriptive name) forces rsyslog daemon to write log messages to separate local log files in /var/log/, where log file names are defined based on the hostname of the remote sending machine as well as the remote application that generated the logs. The second line ("*.* ?RemoteLogs") implies that we apply RemoteLogs template to all received logs. + +The "& ~" sign represents a redirect rule, and is used to tell rsyslog daemon to stop processing log messages further, and not write them locally. If this redirection is not used, all the remote messages would be also written on local log files besides the log files described above, which means they would practically be written twice. Another consequence of using this rule is that the syslog server's own log messages would only be written to dedicated files named after machine's hostname. + +If you want, you can direct log messages with a specific facility or severity level to this new template using the following schema. + + [facility-level].[severity-level] ?RemoteLogs + +For example: + +Direct all internal authentication messages of all priority levels to RemoteLogs template: + + authpriv.* ?RemoteLogs + +Direct informational messages generated by all system processes, except mail, authentication and cron messages to RemoteLogs template: + + *.info,mail.none,authpriv.none,cron.none ?RemoteLogs + +If we want all received messages from remote clients written to a single file named after their IP address, you can use the following template. We assign a new name "IpTemplate" to this template. + + $template IpTemplate,"/var/log/%FROMHOST-IP%.log" + *.* ?IpTemplate + & ~ + +After we have enabled rsyslog daemon and edited its configuration file, we need to restart the daemon. + +On Debian, Ubuntu or CentOS/RHEL 6: + + $ sudo service rsyslog restart + +On Fedora or CentOS/RHEL 7: + + $ sudo systemctl restart rsyslog + +We can verify that rsyslog daemon is functional by using netstat command. + + $ sudo netstat -tulpn | grep rsyslog + +The output should look like the following in case rsyslog daemon listens on UDP port. + + udp 0 0 0.0.0.0:514 0.0.0.0:* 551/rsyslogd + udp6 0 0 :::514 :::* 551/rsyslogd + +If rsyslog daemon is set up to listen on TCP connections, the output should look like this. + + tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 1891/rsyslogd + tcp6 0 0 :::514 :::* LISTEN 1891/rsyslogd + +#### Send Windows Logs to a Remote Rsyslog Server #### + +To forward a Windows based client's log messages to our rsyslog server, we need a Windows syslog agent. While there are a multitude of syslog agents that can run on Windows, we can use [Datagram SyslogAgent][1], which is a freeware program. + +After downloading and installing the syslog agent, we need to configure it to run as a service. Specify the protocol though which it will send data, the IP address and port of a remote rsyslog server, and what type of event logs should be transmitted as follows. + +![](https://farm8.staticflickr.com/7509/15305930594_27b7f4440a_o.jpg) + +After we have set up all the configurations, we can start the service and watch the log files on the central rsyslog server using tailf command line utility. + +### Conclusion ### + +By creating a central rsyslog server that can collect log files of local or remote hosts, we can get a better idea on what is going on internally in their systems, and can debug their problems more easily should any of them become unresponsive or crash. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/configure-syslog-server-linux.html + +作者:[Caezsar M][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/caezsar +[1]:http://www.syslogserver.com/download.html \ No newline at end of file diff --git a/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md b/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md new file mode 100644 index 0000000000..fcd7c04232 --- /dev/null +++ b/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md @@ -0,0 +1,247 @@ +How to create a custom backup plan for Debian with backupninja +================================================================================ +Backupninja is a powerful and highly-configurable backup tool for Debian based distributions. In the [previous tutorial][1], we explored how to install backupninja and how to set up two backup actions for the program to perform. However, we should note that those examples were only "the tip of the iceberg," so to speak. In this post we will discuss how to leverage custom handlers and helpers that allow this program to be customized in order to accomplish almost any backup need that you can think of. + +And believe me - that is not an overstatement, so let's begin. + +### A Quick Review of Backupninja ### + +One of backupninja's distinguishing features is the fact that you can just drop plain text configuration or action files in /etc/backup.d, and the program will take care of the rest. In addition, we can write custom scripts (aka "handlers") and place them in /usr/share/backupninja to handle each type of backup action. Furthermore, we can have these scripts be executed via ninjahelper's ncurses-based interactive menus (aka "helpers") to guide us to create the configuration files we mentioned earlier, minimizing the chances of human error. + +### Creating a Custom Handler and Helper ### + +Our goal in this case is to create a script to handle the backup of chosen home directories into a tarball with either **gzip** or **bzip2** compression, excluding music and video files. We will simply name this script home, and place it under /usr/backup/ninja. + +Although you could achieve the same objective with the default tar handler (refer to /usr/share/backupninja/tar and /usr/share/backupninja/tar.helper), we will use this approach to show how to create a useful handler script and ncurses-based helper from scratch. You can then decide how to apply the same principles depending on your specific needs. + +Note that since handlers are sourced from the main script, there is no need to start with #!/bin/bash at the top. + +Our proposed handler (/usr/share/backupninja/home) is as follows. It is heavily commented for clarification. The getconf function is used to read the backup action's configuration file. If you specify a value for a variable here, it will override the corresponding value present in the configuration file: + + # home handler script for backupninja + + # Every backup file will identify the host by its FQDN + getconf backupname + + # Directory to store backups + getconf backupdir + + # Default compression + getconf compress + + # Include /home directory + getconf includes + + # Exclude files with *.mp3 and *.mp4 extensions + getconf excludes + + # Default extension for the packaged backup file + getconf EXTENSION + + # Absolute path to date binary + getconf TAR `which tar` + + # Absolute path to date binary + getconf DATE `which date` + + # Chosen date format + DATEFORMAT="%Y-%m-%d" + + # If backupdir does not exist, exit with fatal error + if [ ! -d "$backupdir" ] + then + mkdir -p "$backupdir" || fatal "Can not make directory $backupdir" + fi + + # If backupdir is not writeable, exit with fatal error as well + if [ ! -w "$backupdir" ] + then + fatal "Directory $backupdir is not writable" + fi + + # Set the right tar option as per the chosen compression format + case $compress in + "gzip") + compress_option="-z" + EXTENSION="tar.gz" + ;; + "bzip") + compress_option="-j" + EXTENSION="tar.bz2" + ;; + "none") + compress_option="" + ;; + *) + warning "Unknown compress filter ($tar_compress)" + compress_option="" + EXTENSION="tar.gz" + ;; + esac + + # Exclude the following file types / directories + exclude_options="" + for i in $excludes + do + exclude_options="$exclude_options --exclude $i" + done + + # Debugging messages, performing backup + debug "Running backup: " $TAR -c -p -v $compress_option $exclude_options \ + -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ + $includes + + # Redirect standard output to a file with .list extension + # and standard error to a file with .err extension + $TAR -c -p -v $compress_option $exclude_options \ + -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ + $includes \ + > "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.list \ + 2> "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.err + + [ $? -ne 0 ] && fatal "Tar backup failed" + +Next, we will create our helper file (/usr/share/backupninja/home.helper) so that our handlers shows up as a menu in **ninjahelper**: + + # Backup action's description. Separate words with underscores. + HELPERS="$HELPERS home:backup_of_home_directories" + + home_wizard() { + home_title="Home action wizard" + + backupname=`hostname --fqdn` + + # Specify default value for the time when this backup actions is supposed to run + inputBox "$home_title" "When to run this action?" "everyday at 01" + [ $? = 1 ] && return + home_when_run="when = $REPLY" + + # Specify default value for backup file name + inputBox "$home_title" "\"Name\" of backups" "$backupname" + [ $? = 1 ] && return + home_backupname="backupname = $REPLY" + backupname="$REPLY" + + # Specify default directory to store the backups + inputBox "$home_title" "Directory where to store the backups" "/var/backups/home" + [ $? = 1 ] && return + home_backupdir="backupdir = $REPLY" + + # Specify default values for the radiobox + radioBox "$home_title" "Compression" \ + "none" "No compression" off \ + "gzip" "Compress with gzip" on \ + "bzip" "Compress with bzip" off + [ $? = 1 ] && return; + result="$REPLY" + home_compress="compress = $REPLY " + + REPLY= + while [ -z "$REPLY" ]; do + formBegin "$home_title: Includes" + formItem "Include:" /home/gacanepa + formDisplay + [ $? = 0 ] || return 1 + home_includes="includes = " + for i in $REPLY; do + [ -n "$i" ] && home_includes="$home_includes $i" + done + done + + REPLY= + while [ -z "$REPLY" ]; do + formBegin "$home_title: Excludes" + formItem "Exclude:" *.mp3 + formItem "Exclude:" *.mp4 + # Add as many “Exclude” text boxes as needed to specify other exclude options + formItem "Exclude:" + formItem "Exclude:" + formDisplay + [ $? = 0 ] || return 1 + home_excludes="excludes = " + for i in $REPLY; do + [ -n "$i" ] && home_excludes="$home_excludes $i" + done + done + + # Save the config + get_next_filename $configdirectory/10.home + cat > $next_filename <> /etc/apt/sources.list' + $ sudo apt-get update + $ sudo apt-get install ajenti + +#### Install Ajenti on Ubuntu #### + + $ wget http://repo.ajenti.org/debian/key -O- | sudo apt-key add - + $ sudo sh -c 'echo "deb http://repo.ajenti.org/ng/debian main main ubuntu" >> /etc/apt/sources.list' + $ sudo apt-get update + $ sudo apt-get install ajenti + +#### Install Ajenti on CentOS/RHEL or Fedora #### + +On CentOS/RHEL, [configure][4] EPEL repository first, and then run the following. On Fedora, use the following commands directly. + + $ wget http://repo.ajenti.org/ajenti-repo-1.0-1.noarch.rpm + $ sudo rpm -ivh ajenti-repo-1.0-1.noarch.rpm + $ sudo yum install ajenti + +Next, configure the firewall. + +On Fedora or CentOS/RHEL 7: + + $ sudo firewall-cmd --zone=public --add-port=8000/tcp --permanent + $ sudo firewall-cmd --reload + +On CentOS/RHEL 6: + + $ sudo iptables -I INPUT -p tcp -m tcp --dport 8000 -j ACCEPT + $ sudo service iptables save + +### Access Ajenti Web Interface ### + +Before accessing Ajenti's web interface, make sure to start ajenti service. + + $ sudo service ajenti restart + +Direct your web browser to https://:8000, and you will see the following Ajenti login interface. + +![](https://farm8.staticflickr.com/7512/15712738197_eeccd0f9dd_z.jpg) + +The default login credential is "root" for username and "admin" for password. Once you log in, you will see the initial Ajengi menu. + +![](https://farm8.staticflickr.com/7498/15897850312_d2ca46fa4b_z.jpg) + +Under "SOFTWARE" section in the left panel, you will see a list of installed services. When you install any new server software supported by Ajenti, the software will be automatically added to the list once you restart ajenti service. + + $ sudo service ajenti restart + +### VPS Management via Ajenti Web Interface ### + +Ajenti's web interface is extremely intuitive and easy to use. Here are a few examples of Ajenti functionality. + +#### Pluggable Architecture #### + +Ajenti comes with a number of application-specific plugins, which makes Ajenti highly extensible. When you install a new software on your VPS, a corresponding Ajenti plugin (if any) will be automatically enabled to manage the software. The "Plugins" menu will show what plugins are available/enabled, and which plugin is associated with what software. + +![](https://farm8.staticflickr.com/7501/15872690086_26d05ea570_z.jpg) + +#### Package Management #### + +Ajenti offers a web interface for installing and upgrading packages on VPS. + +![](https://farm9.staticflickr.com/8571/15896505171_daf8c2d9db_z.jpg) + +#### Firewall Configuration #### + +Ajenti allows you to manage firewall rules (iptables or CSF) in two ways. One is to use a user-friendly web panel interface, and the other is to edit raw firewall rules directly. + +![](https://farm8.staticflickr.com/7490/15276234634_a220f2a555_z.jpg) + +![](https://farm8.staticflickr.com/7499/15711196520_343d0668ff_z.jpg) + +#### Log Inspection #### + +You can browse system logs in /var/log via Ajenti's web interface. + +![](https://farm8.staticflickr.com/7529/15276234684_a5375c9b6d_z.jpg) + +#### Process Monitoring #### + +You can see a list of processes sorted by CPU or RAM usage, and can kill them as needed. + +![](https://farm8.staticflickr.com/7556/15711008948_ed359c284d_z.jpg) + +#### Terminal Access #### + +For low-level VPS access, Ajenti offers a web-based terminal interface where you can type Linux commands. You can open multiple terminal tabs within a web panel as shown below. + +![](https://farm8.staticflickr.com/7568/15896505251_8271ac16dd_z.jpg) + +#### Apache Web Server Administration #### + +You can edit Apache configuration file, and manage apache2 service. + +![](https://farm8.staticflickr.com/7572/15711009108_bb806d2dcd_z.jpg) + +#### MySQL/MariaDB Management #### + +You can access MySQL/MariaDB server and execute raw SQL commands on it. + +![](https://farm8.staticflickr.com/7580/15276234754_02375fd17b_z.jpg) + +#### Squid Configuration #### + +You can configure ACL, HTTP access rules, filtering ports for Squid proxy server. + +![](https://farm8.staticflickr.com/7568/15712738507_e2ef48b78f_z.jpg) + +#### Startup Service Management #### + +You can view, start, stop and restart installed services. + +![](https://farm8.staticflickr.com/7538/15898503935_1edf5c67ae_z.jpg) + +### Conclusion ### + +Ajenti is a convenient and easy-to-use web control panel for common server administration, with the possibility to add [custom plugins][5] that you can develop. However, remember that any good control panel does not obviate the need for you to learn what's happening behind the scene on your [VPS][6]. A control panel will become a real time saver only when you fully understand what you are doing, and be able to handle the consequence of your action without relying on the control panel. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/free-control-panel-for-vps.html + +作者:[Dan Nanni][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/go/digitalocean +[2]:http://ajenti.org/ +[3]:http://ajenti.org/licensing +[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html +[5]:http://docs.ajenti.org/en/latest/dev/intro.html +[6]:http://xmodulo.com/go/digitalocean \ No newline at end of file From bae30fddc09374099f4b7069383c93a612c0a4b4 Mon Sep 17 00:00:00 2001 From: DoubleC <450760206@qq.com> Date: Sat, 6 Dec 2014 10:26:22 +0800 Subject: [PATCH 6/7] Update 20141205 How to create a custom backup plan for Debian with backupninja.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领文章 --- ... create a custom backup plan for Debian with backupninja.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md b/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md index fcd7c04232..a705c44b3b 100644 --- a/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md +++ b/sources/tech/20141205 How to create a custom backup plan for Debian with backupninja.md @@ -1,3 +1,4 @@ +SPccman translating How to create a custom backup plan for Debian with backupninja ================================================================================ Backupninja is a powerful and highly-configurable backup tool for Debian based distributions. In the [previous tutorial][1], we explored how to install backupninja and how to set up two backup actions for the program to perform. However, we should note that those examples were only "the tip of the iceberg," so to speak. In this post we will discuss how to leverage custom handlers and helpers that allow this program to be customized in order to accomplish almost any backup need that you can think of. @@ -244,4 +245,4 @@ via: http://xmodulo.com/create-custom-backup-plan-debian.html [a]:http://xmodulo.com/author/gabriel [1]:http://xmodulo.com/backup-debian-system-backupninja.html -[2]:http://xmodulo.com/backup-debian-system-backupninja.html \ No newline at end of file +[2]:http://xmodulo.com/backup-debian-system-backupninja.html From a5a76e14a91722e40d2b0f5d6cac9f3b5e56237a Mon Sep 17 00:00:00 2001 From: su-kaiyao <1250471161@qq.com> Date: Sat, 6 Dec 2014 12:50:01 +0800 Subject: [PATCH 7/7] su-kaiyao translating --- ...Run Linux Programs From The Terminal In Background Mode.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md b/sources/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md index 6ab48a5930..92fc98f023 100644 --- a/sources/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md +++ b/sources/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md @@ -1,3 +1,5 @@ +[su-kaiyao] translating + How To Run Linux Programs From The Terminal In Background Mode ================================================================================ ![Linux Terminal Window.](http://0.tqn.com/y/linux/1/W/r/G/1/terminal.JPG) @@ -83,4 +85,4 @@ via: http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-The-Te [2]:http://linux.about.com/od/commands/l/blcmdl1_locate.htm [3]:http://linux.about.com/library/cmd/blcmdl1_less.htm [4]:http://linux.about.com/library/cmd/blcmdl1_more.htm -[5]:http://linux.about.com/od/commands/l/blcmdl8_sudo.htm \ No newline at end of file +[5]:http://linux.about.com/od/commands/l/blcmdl8_sudo.htm