mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-12 01:40:10 +08:00
commit
8271ee706a
@ -1,10 +1,10 @@
|
||||
在Ubuntu 14.10中如何安装和配置‘My Weather Indicator’
|
||||
在Ubuntu 14.10中如何安装和配置‘天气信息指示器’
|
||||
================================================================================
|
||||

|
||||
|
||||
**在Ubuntu桌面中不缺乏若干应用同时提供天气信息的方法,你可以使用Unity Dash和桌面应用,比如[Typhoon][1],来获得天气信息。**
|
||||
**在Ubuntu桌面中有各种提供天气信息的方法,你可以使用Unity Dash和桌面应用来获得天气信息,比如[Typhoon][1]。**
|
||||
|
||||
但是可以提供快速查询天气状况和温度数据,并且只需要一次鼠标点击而获得大量气象数据的面板插件,是到目前为止Linux平台下最受欢迎的天气应用。
|
||||
但是可以提供快速查询天气状况和温度数据,并且只需要一次鼠标点击而获得大量气象数据的面板插件,才是到目前为止Linux平台下最受欢迎的天气应用。
|
||||
|
||||
Atareao开发的[My Weather Indicator][2]就是这类应用中的一个,也可以说是最好的一个。
|
||||
|
||||
@ -18,7 +18,7 @@ My Weather Indicator无法从Ubuntu软件商店中直接获取。不过开发者
|
||||
|
||||
- 下载My Weather Indicator (.deb安装包)
|
||||
|
||||
为了确保你的应用最是最新版本,我建议将[Atareao PPA][3]添加到你的软件镜像源然后通过PPA来安装。
|
||||
为了确保你的应用是最新版本,我建议将[Atareao PPA][3]添加到你的软件镜像源,然后通过PPA来安装。
|
||||
|
||||
怎么做?**打开一个新的终端**窗口(Unity Dash > 终端,或者按Ctrl+Alt+T快捷键),然后**输入下面的两行命令**,期间你需要在提示处输入你的系统密码:
|
||||
|
||||
@ -36,7 +36,7 @@ My Weather Indicator无法从Ubuntu软件商店中直接获取。不过开发者
|
||||
|
||||

|
||||
|
||||
如果你正在旅行(或者是出于聊天需要),**你可以添加一个第二地区**。这个设置和第一地区的设置相同,只不过是在“第二地区”的标签栏罢了。
|
||||
如果你正在旅行(或者是出于聊天的需要),**你可以添加一个第二地区**。这个设置和第一地区的设置相同,只不过是出现在“第二地区”的标签栏罢了。
|
||||
|
||||
在“**小部件设置**”区域勾选“**显示桌面小部件**”选项就会在你的桌面上添加一个小的天气小部件。小部件提供许多不同的皮肤,所以你一定要精心挑选你最喜欢的一个(注释:点击“确定”后对小部件的更改才会保存)。
|
||||
|
||||
@ -55,7 +55,7 @@ My Weather Indicator使用[Open Weather Map][4]作为默认的天气数据提供
|
||||
|
||||
最后,在‘General Options‘标签页,你可以设置数据更新间隔、设置开机自动运行选项以及从两个图标中选择一个作为面板图标。
|
||||
|
||||
如果你不喜欢该应用,你可以尝试[Linux下查看天气数据的方法][5]。
|
||||
如果你是命令行控,你也可以尝试[Linux下查看天气数据的方法][5]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -63,7 +63,7 @@ via: http://www.omgubuntu.co.uk/2014/10/install-weather-indicator-ubuntu-14-10
|
||||
|
||||
作者:[Joey-Elijah Sneddon][a]
|
||||
译者:[JonathanKang](https://github.com/JonathanKang)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
@ -1,18 +1,18 @@
|
||||
VPS上好的控制面板是什么
|
||||
推荐一款不错的 VPS 控制面板:Ajenti
|
||||
================================================================================
|
||||
任何有经验的Linux人员都认为没有一款控制面板可以打败纯命令行界面来管理[虚拟主机][1](VPS)。也有人争论有一款好的面板的一席之地,因为流线型的界面让常规管理操作可以通过点几下鼠标就可以完成。
|
||||
任何有经验的Linux人员都认为没有任何一款控制面板可以打败纯命令行界面来管理[虚拟主机][1](VPS)。也有人争辩说好的控制面板还是应该有一席之地,因为顺滑的操作界面让常规管理操作通过点几下鼠标就可以完成。
|
||||
|
||||
至于控制面板,有共恩那个强大的充满警铃和汽笛的商业控制面板,也有不同免费的但也强大多功能的免费开源面板替代。这之中杰出的代表是[Ajenti][2]控制面板。
|
||||
至于控制面板,有那种强大的充满警铃和汽笛的商业控制面板,也有不同免费的但也强大多功能的免费开源面板替代品。这之中杰出的代表是[Ajenti][2]控制面板。
|
||||
|
||||
Ajenti可以让你很简单地配置不同的通用服务程序,如Apache/nginx、Samba、BIND、Squid、MySQL、cron、防火墙等等,对管理通用VPS实例可以节省大量的时间。对于生产环境,Ajenti同样提供了插件和平台来支持虚拟web主机管理和自定义web UI开发。
|
||||
Ajenti可以让你很简单地配置不同的常规服务程序,如Apache/nginx、Samba、BIND、Squid、MySQL、cron、防火墙等等,对管理常规的 VPS 实例可以节省大量的时间。对于生产环境,Ajenti同样提供了插件和平台来支持虚拟 web 主机管理和自定义 web UI开发。
|
||||
|
||||
Ajenti有[双重授权][3];一个是个人、企业内部或者教育用途免费使用的AGPLv3。然而,如果你是一家托管企业或者硬件提供商,那么你需要购买商业授权来使用Ajenti作为商业供应。
|
||||
Ajenti有[双重授权][3];一个是针对个人、企业内部或者教育用途免费使用的AGPLv3。然而,如果你是一家托管企业或者硬件提供商,那么你需要购买商业授权来使用Ajenti作为商业服务。
|
||||
|
||||
### 在Linux上安装Ajenti ###
|
||||
|
||||
为了简化安装,Ajenti为主流Linux发行版提供了自己的仓库。安装Ajenti要做的就是配置目标仓库,并用默认包管理器来安装。
|
||||
|
||||
安装前,一个RSA密钥和证书会生成用于SSL,Ajenti会见在8000端口监听HTTPS的web请求。如果你正在使用防火墙,你需要在防火墙中允许8000端口。为了安全,最好默认禁止8000端口的访问,并添加少数IP地址到白名单中。
|
||||
安装前会生成用于SSL的一个RSA密钥和证书,Ajenti会在8000端口监听HTTPS的web请求。如果你正在使用防火墙,你需要在防火墙中允许8000端口访问。为了安全,最好默认禁止8000端口的公开访问,并添加你的少数IP地址到白名单中。
|
||||
|
||||
#### 在Debian上安装Ajenti ####
|
||||
|
||||
@ -54,7 +54,7 @@ Ajenti有[双重授权][3];一个是个人、企业内部或者教育用途免
|
||||
|
||||
$ sudo service ajenti restart
|
||||
|
||||
直接在浏览器中输入https://<server-ip-address>:8000,你就会看到下面的Ajenti的登录界面。
|
||||
直接在浏览器中输入https://\<server-ip-address>:8000,你就会看到下面的Ajenti的登录界面。
|
||||
|
||||

|
||||
|
||||
@ -62,7 +62,7 @@ Ajenti有[双重授权][3];一个是个人、企业内部或者教育用途免
|
||||
|
||||

|
||||
|
||||
在左边面板的"SOFTWARE"选项下,你会看接一列安装的服务。当你安装了任何Ajenti支持的服务端程序时,软件会在重启ajenti服务后被自动加入列表。
|
||||
在左边面板的"SOFTWARE"选项下,你会看带一些已安装的服务。当你安装了任何Ajenti支持的服务端程序时,软件会在重启ajenti服务后被自动加入列表。
|
||||
|
||||
$ sudo service ajenti restart
|
||||
|
||||
@ -84,7 +84,7 @@ Ajenti提供了一个web界面来安装和升级VPS上的包。
|
||||
|
||||
#### 防火墙配置 ####
|
||||
|
||||
Ajenti允许你用两种方法管理防火墙规则(iptables或者CSF)。一种是使用用户友好的web面板,另一种是直接编辑原生的防火墙规则。
|
||||
Ajenti允许你用两种方法管理防火墙规则(使用iptables或者CSF)。一种方法是使用用户友好的web面板,另一种是直接编辑原始的防火墙规则。
|
||||
|
||||

|
||||
|
||||
@ -98,25 +98,25 @@ Ajenti允许你用两种方法管理防火墙规则(iptables或者CSF)。一
|
||||
|
||||
#### 进程监控 ####
|
||||
|
||||
你可以u看见按照CPU和内存使用率排序的进程列表,按需可以结束它们。
|
||||
你可以看见按照CPU和内存使用率排序的进程列表,如果需要的话,也可以干掉它们。
|
||||
|
||||

|
||||
|
||||
#### 终端访问 ####
|
||||
|
||||
对于底层VPS访问,Ajenti提供了基于web的终端界面,你在这可以输入Linux命令。你也可以像下面那样在一个面板中打开多个终端。
|
||||
如果需要更低层面的VPS访问,Ajenti提供了基于web的终端界面,你在这可以输入Linux命令。你也可以像下面那样在一个面板中打开多个终端。
|
||||
|
||||

|
||||
|
||||
#### Apache Web服务管理 ####
|
||||
|
||||
你可以编辑Apache配额文件,并管理apche2服务。
|
||||
你可以编辑Apache配置文件,并管理apache2服务。
|
||||
|
||||

|
||||
|
||||
#### MySQL/MariaDB 管理 ####
|
||||
|
||||
你可以访问MySQL/MariaDB服务并直接在上面执行原生SQL命令。
|
||||
你可以访问MySQL/MariaDB服务并直接在上面执行原始SQL命令。
|
||||
|
||||

|
||||
|
||||
@ -128,13 +128,13 @@ Ajenti允许你用两种方法管理防火墙规则(iptables或者CSF)。一
|
||||
|
||||
#### 启动服务管理 ####
|
||||
|
||||
你可以浏览、启动、停止、重启安装的服务。
|
||||
你可以浏览、启动、停止、重启已安装的服务。
|
||||
|
||||

|
||||
|
||||
### 总结 ###
|
||||
|
||||
Ajenti是一款易于使用的服务器管理控制面板,可以加入你开发的[自定义插件][5]。然而,记住任何好的控制面板都不会排除你学习面板后[VPS][6]上发生的情况的需求。一款面板会在你完全了解你正在做的事情的时候成会一款真正节省时间的利器,并且不依赖于控制面版来处理你行动的结果。
|
||||
Ajenti是一款易于使用的服务器管理控制面板,可以加入你开发的[自定义插件][5]。然而请记住,任何好的控制面板都不是阻止你学习在控制面板之后[VPS][6]里发生了什么的原因。一款好的面板会在你完全了解你正在做的事情时成会一款真正节省时间的利器,并且不依赖于控制面版来达成你所需要的目标。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -142,7 +142,7 @@ via: http://xmodulo.com/free-control-panel-for-vps.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/) 荣誉推出
|
||||
|
||||
@ -150,6 +150,6 @@ via: http://xmodulo.com/free-control-panel-for-vps.html
|
||||
[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
|
||||
[4]:http://linux.cn/article-2324-1.html
|
||||
[5]:http://docs.ajenti.org/en/latest/dev/intro.html
|
||||
[6]:http://xmodulo.com/go/digitalocean
|
@ -0,0 +1,164 @@
|
||||
在Linux中使用matplotlib进行科学画图
|
||||
================================================================================
|
||||
|
||||
如果你想要在Linxu中获得一个高效、自动化、高质量的科学画图的解决方案,应该考虑尝试下matplotlib库。Matplotlib是基于python的开源科学测绘包,基于python软件基金会许可证发布。大量的文档和例子、集成了Python和Numpy科学计算包、以及自动化能力,是作为Linux环境中进行科学画图的可靠选择的几个原因。这个教程将提供几个用matplotlib画图的例子。
|
||||
|
||||
###特性###
|
||||
|
||||
- 支持众多的图表类型,如:bar,box,contour,histogram,scatter,line plots....
|
||||
- 基于python的语法
|
||||
- 集成Numpy科学计算包
|
||||
- 数据源可以是 python 的列表、键值对和数组
|
||||
- 可定制的图表格式(坐标轴缩放、标签位置及标签内容等)
|
||||
- 可定制文本(字体,大小,位置...)
|
||||
- 支持TeX格式(等式,符号,希腊字体...)
|
||||
- 与IPython相兼容(允许在 python shell 中与图表交互)
|
||||
- 自动化(使用 Python 循环创建图表)
|
||||
- 用Python 的循环迭代生成图片
|
||||
- 保存所绘图片格式为图片文件,如:png,pdf,ps,eps,svg等
|
||||
|
||||
基于Python语法的matplotlib是其许多特性和高效工作流的基础。世面上有许多用于绘制高质量图的科学绘图包,但是这些包允许你直接在你的Python代码中去使用吗?除此以外,这些包允许你创建可以保存为图片文件的图片吗?Matplotlib允许你完成所有的这些任务。从而你可以节省时间,使用它你能够花更少的时间创建更多的图片。
|
||||
|
||||
###安装###
|
||||
安装Python和Numpy包是使用Matplotlib的前提,安装Numpy的指引请见[该链接][1]。
|
||||
|
||||
|
||||
可以通过如下命令在Debian或Ubuntu中安装Matplotlib:
|
||||
|
||||
$ sudo apt-get install python-matplotlib
|
||||
|
||||
在Fedora或CentOS/RHEL环境则可用如下命令:
|
||||
|
||||
$ sudo yum install python-matplotlib
|
||||
|
||||
|
||||
###Matplotlib 例子###
|
||||
|
||||
本教程会提供几个绘图例子演示如何使用matplotlib:
|
||||
|
||||
- 离散图和线性图
|
||||
- 柱状图
|
||||
- 饼状图
|
||||
|
||||
在这些例子中我们将用Python脚本来执行Mapplotlib命令。注意numpy和matplotlib模块需要通过import命令在脚本中进行导入。
|
||||
|
||||
np为nuupy模块的命名空间引用,plt为matplotlib.pyplot的命名空间引用:
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
###例1:离散和线性图###
|
||||
|
||||
第一个脚本,script1.py 完成如下任务:
|
||||
|
||||
- 创建3个数据集(xData,yData1和yData2)
|
||||
- 创建一个宽8英寸、高6英寸的图(赋值1)
|
||||
- 设置图画的标题、x轴标签、y轴标签(字号均为14)
|
||||
- 绘制第一个数据集:yData1为xData数据集的函数,用圆点标识的离散蓝线,标识为"y1 data"
|
||||
- 绘制第二个数据集:yData2为xData数据集的函数,采用红实线,标识为"y2 data"
|
||||
- 把图例放置在图的左上角
|
||||
- 保存图片为PNG格式文件
|
||||
|
||||
script1.py的内容如下:
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
xData = np.arange(0, 10, 1)
|
||||
yData1 = xData.__pow__(2.0)
|
||||
yData2 = np.arange(15, 61, 5)
|
||||
plt.figure(num=1, figsize=(8, 6))
|
||||
plt.title('Plot 1', size=14)
|
||||
plt.xlabel('x-axis', size=14)
|
||||
plt.ylabel('y-axis', size=14)
|
||||
plt.plot(xData, yData1, color='b', linestyle='--', marker='o', label='y1 data')
|
||||
plt.plot(xData, yData2, color='r', linestyle='-', label='y2 data')
|
||||
plt.legend(loc='upper left')
|
||||
plt.savefig('images/plot1.png', format='png')
|
||||
|
||||
|
||||
所画之图如下:
|
||||
|
||||

|
||||
|
||||
|
||||
###例2:柱状图###
|
||||
|
||||
第二个脚本,script2.py 完成如下任务:
|
||||
|
||||
- 创建一个包含1000个随机样本的正态分布数据集。
|
||||
- 创建一个宽8英寸、高6英寸的图(赋值1)
|
||||
- 设置图的标题、x轴标签、y轴标签(字号均为14)
|
||||
- 用samples这个数据集画一个40个柱状,边从-10到10的柱状图
|
||||
- 添加文本,用TeX格式显示希腊字母mu和sigma(字号为16)
|
||||
- 保存图片为PNG格式。
|
||||
|
||||
script2.py代码如下:
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
mu = 0.0
|
||||
sigma = 2.0
|
||||
samples = np.random.normal(loc=mu, scale=sigma, size=1000)
|
||||
plt.figure(num=1, figsize=(8, 6))
|
||||
plt.title('Plot 2', size=14)
|
||||
plt.xlabel('value', size=14)
|
||||
plt.ylabel('counts', size=14)
|
||||
plt.hist(samples, bins=40, range=(-10, 10))
|
||||
plt.text(-9, 100, r'$\mu$ = 0.0, $\sigma$ = 2.0', size=16)
|
||||
plt.savefig('images/plot2.png', format='png')
|
||||
|
||||
|
||||
结果见如下链接:
|
||||
|
||||

|
||||
|
||||
|
||||
###例3:饼状图###
|
||||
|
||||
第三个脚本,script3.py 完成如下任务:
|
||||
|
||||
- 创建一个包含5个整数的列表
|
||||
- 创建一个宽6英寸、高6英寸的图(赋值1)
|
||||
- 添加一个长宽比为1的轴图
|
||||
- 设置图的标题(字号为14)
|
||||
- 用data列表画一个包含标签的饼状图
|
||||
- 保存图为PNG格式
|
||||
|
||||
脚本script3.py的代码如下:
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
data = [33, 25, 20, 12, 10]
|
||||
plt.figure(num=1, figsize=(6, 6))
|
||||
plt.axes(aspect=1)
|
||||
plt.title('Plot 3', size=14)
|
||||
plt.pie(data, labels=('Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5'))
|
||||
plt.savefig('images/plot3.png', format='png')
|
||||
|
||||
|
||||
结果如下链接所示:
|
||||
|
||||

|
||||
|
||||
|
||||
###总结###
|
||||
|
||||
这个教程提供了几个用matplotlib科学画图包进行画图的例子,Matplotlib是在Linux环境中用于解决科学画图的绝佳方案,表现在其无缝地和Python、Numpy连接、自动化能力,和提供多种自定义的高质量的画图产品。matplotlib包的文档和例子详见[这里][2]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/matplotlib-scientific-plotting-linux.html
|
||||
|
||||
作者:[Joshua Reed][a]
|
||||
译者:[ideas4u](https://github.com/ideas4u)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://xmodulo.com/author/joshua
|
||||
[1]:http://xmodulo.com/numpy-scientific-computing-linux.html
|
||||
[2]:http://matplotlib.org/
|
@ -1,12 +1,12 @@
|
||||
如何在Linux终端下安排约会和待办事项
|
||||
在Linux终端下使用 calcurse 安排约会和待办事项
|
||||
================================================================================
|
||||
如果你是一个享受linux终端的系统管理员,但同样需要一中方法来安排每天最重要的任务、约会和会议,你会发现[calcurse][1]是一个很有用的工具。calcurse包含了日历、一个待办事项管理、一个调度程序和一个可配置的通知系统,这些都集成进了一个软件中,基于的都是ncurse的接口。同时,它不会限制你在终端中,你可以将你的日历和笔记导出成可以打印的格式。
|
||||
如果你是一个享受linux终端的系统管理员,但同样需要一种方法来安排每天最重要的任务、约会和会议,你会发现[calcurse][1]是一个很有用的工具。calcurse包含了日历、一个待办事项管理、一个调度程序和一个可配置的通知系统,这些都集成进了一个软件中,基于的都是ncurse的接口。同时,它不会限制你在终端中,你可以将你的日历和笔记导出成可以打印的格式。
|
||||
|
||||
本片文章我们会探索如何在Linux上安装calcurse,并且教你如何利用它的特性。
|
||||
本篇文章我们会探索如何在Linux上安装calcurse,并且教你如何利用它的特性。
|
||||
|
||||
### 在Linux上安装Culcurse ###
|
||||
|
||||
calcurse在大多数Linux发行版的标准仓库都有。万一在你的发行版上没有(比如CentOS/RHEL),一旦你安装了gcc和ncurse开发文件后就可以很简单地从源码安装。
|
||||
calcurse在大多数Linux发行版的标准仓库都有。万一在你的发行版上没有(比如CentOS/RHEL),只要你安装了gcc和ncurse开发文件后就可以很简单地从源码安装。
|
||||
|
||||
Debian、Ubuntu或者Linux Mint
|
||||
|
||||
@ -32,22 +32,22 @@ CentOS/RHEL
|
||||
|
||||
$ calcurse
|
||||
|
||||
你将会看到下面的空白界面。如果配色不吸引你,你可以以后改变它们。
|
||||
你将会看到下面的空白界面。如果这配色不吸引你,你可以以后换一个。
|
||||
|
||||

|
||||
|
||||
我们现在可以按下回车-‘q’- 再次按下回车- ‘y’来退出主界面。这个序列会告诉地不的菜单退出、保存当前的笔记并确认退出。
|
||||
我们现在可以按下回车-‘q’- 再次按下回车- ‘y’来退出主界面。这个按键序列激活界面底部的主菜单,并告诉它保存当前的笔记并确认退出。
|
||||
|
||||
When we run calcurse for the first time, the following directory structure is created in our home directory:
|
||||
我们第一次运行 calcurse 时,会在主目录创建如下子目录:
|
||||
|
||||

|
||||
|
||||
这里是每一项的简要描述:
|
||||
这里是每一个子目录的简要描述:
|
||||
|
||||
- **apts** 文件包含了用户所有的约会和事项,todo文件包含了所有的**todo** 列表。
|
||||
- **apts**文件包含了用户所有的约会和事项,todo文件包含了所有的**待办事项** 列表。
|
||||
- **conf**文件,如你所想的那样,包含当前用户的独立设置。
|
||||
- **keys**文件包含了用户定义的按键绑定(比如:q或者Q推出,x或者X导出内容等等)。
|
||||
- 在**notes**子目录你会看到包含了笔记描述的文件,你可以附到任何一个安排事项中。
|
||||
- **keys**文件包含了用户定义的按键绑定(比如:q或者Q退出,x或者X导出内容等等)。
|
||||
- 在**notes**子目录你会看到包含了笔记描述的文件,这些笔记你可以附到任何一个安排事项中。
|
||||
|
||||
### 改变配色 ###
|
||||
|
||||
@ -55,13 +55,13 @@ When we run calcurse for the first time, the following directory structure is cr
|
||||
|
||||

|
||||
|
||||
使用最后一幅图的按键绑定来选色前景色和背景色配置来更好地适应你的需求:
|
||||
使用最后一幅图的按键绑定来选择前景色和背景色配置,以更好地适应你的需求:
|
||||
|
||||

|
||||
|
||||
### A添加约会和待办任务 ###
|
||||
### 添加约会和待办任务 ###
|
||||
|
||||
在前面的选项卡中浏览命令菜单时,我们看到按下‘o’可以从一个菜单到下一个菜单。我们可以把第二个菜单作为**安排编辑菜单**。
|
||||
在前面的选项卡中浏览命令菜单时,我们看到按下‘o’可以从一个菜单跳到下一个菜单。我们可以把第二个菜单作为**安排编辑菜单**。
|
||||
|
||||

|
||||
|
||||
@ -87,7 +87,7 @@ When we run calcurse for the first time, the following directory structure is cr
|
||||
|
||||
### 为事项设置通知 ###
|
||||
|
||||
你可以在通知菜单下配置通知。按照相同的步骤来以防改变了配色,但是选择**Notify**而不是**Colour**:
|
||||
你可以在通知菜单下配置通知。按照相同的步骤来改变配色方案,但是选择**Notify**而不是**Colour**:
|
||||
|
||||

|
||||
|
||||
@ -103,7 +103,7 @@ When we run calcurse for the first time, the following directory structure is cr
|
||||
|
||||
### 总结 ###
|
||||
|
||||
本篇教程中我们展示了如何设置一个多样化的调度器和提醒器来帮助你组织每日的活动和提前安排重要的事项。你或许还要calcurse的[PDF 手册][2],还请随意在下面的评论中提出你的疑问。欢迎你的评论,我也很高兴看到这些。
|
||||
本篇教程中我们展示了如何设置一个多样化的调度器和提醒器来帮助你组织每日的活动和提前安排重要的事项。你或许还要看看calcurse的[PDF 手册][2],请随意在下面的评论中提出你的疑问。欢迎你的评论,我也很高兴看到这些。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -111,7 +111,7 @@ via: http://xmodulo.com/schedule-appointments-todo-tasks-linux-terminal.html
|
||||
|
||||
作者:[Gabriel Cánepa][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/) 荣誉推出
|
||||
|
@ -1,6 +1,6 @@
|
||||
CentOS 7中安装Websvn
|
||||
在 CentOS 7中安装Websvn
|
||||
================================================================================
|
||||
**WebSVN**为你的Subversion提供了一个试图,它设计用来反映Subversion的一整套方法。你可以检查任何文件或目录的日志,以及查看任何指定修改库中修改、添加或删除过的文件列表。你也可以检查同一文件两个版本的不同之处,以便确切地查看某个特性修订版中的修改。
|
||||
**WebSVN**为你的Subversion提供了一个视图,其设计用来对应Subversion的各种功能。你可以检查任何文件或目录的日志,以及查看任何指定版本中所修改、添加或删除过的文件列表。你也可以检查同一文件两个版本的不同之处,以便确切地查看某个特定的修订版本的变化。
|
||||
|
||||
### 特性 ###
|
||||
|
||||
@ -8,31 +8,25 @@ WebSVN提供了以下这些特性:
|
||||
|
||||
- 易于使用的界面;
|
||||
- 可自定义的模板系统;
|
||||
- 文件列表的着色;
|
||||
- 彩色文件列表;
|
||||
- 过错视图;
|
||||
- 日志信息搜索;
|
||||
- 支持RSS订阅;
|
||||
|
||||
### 安装 ###
|
||||
|
||||
我使用以下链接来将Subversion安装到CentOS 7。
|
||||
我按以下链接来将Subversion安装到CentOS 7。
|
||||
|
||||
- [CentOS 7上如何安装Subversion][1]
|
||||
|
||||
**1 – 下载websvn到/var/www/html。**
|
||||
|
||||
cd /var/www/html
|
||||
|
||||
----------
|
||||
|
||||
wget http://websvn.tigris.org/files/documents/1380/49057/websvn-2.3.3.zip
|
||||
|
||||
**2 – 解压zip包。**
|
||||
|
||||
unzip websvn-2.3.3.zip
|
||||
|
||||
----------
|
||||
|
||||
mv websvn-2.3.3 websvn
|
||||
|
||||
**3 – 安装php到你的系统。**
|
||||
@ -42,13 +36,7 @@ WebSVN提供了以下这些特性:
|
||||
**4 – 编辑web svn配置。**
|
||||
|
||||
cd /var/www/html/websvn/include
|
||||
|
||||
----------
|
||||
|
||||
cp distconfig.php config.php
|
||||
|
||||
----------
|
||||
|
||||
vi config.php
|
||||
|
||||
----------
|
||||
@ -96,7 +84,7 @@ via: http://www.unixmen.com/install-websvn-centos-7/
|
||||
|
||||
作者:[M.el Khamlichi][a]
|
||||
译者:[GOLinux](https://github.com/GOLinux)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,186 @@
|
||||
如何在Linux命令行中创建以及展示演示稿
|
||||
================================================================================
|
||||
你在准备一场演讲的时候,脑海可能会先被图文并茂、形象华丽的演示图稿所占据。诚然,没有人会否认一份生动形象的演讲稿所带来的积极作用。然而,并非所有的演讲都需要TED Talk的质量。更多时候,演讲稿只为传达特定的信息。 而这个,使用文本信息足以完成。在这种情况下,你的时间可以更好的花在信息的搜集和核实上面,而不是在谷歌图片搜索(Google Image)上寻找好看的图片。
|
||||
|
||||
在Linux的世界里,有几个不同的方式供你选择来做演讲。比如带有大量多媒体展示、视觉冲击效果极佳的[Impress.js][1],专为LaTex用户提供的Beamer,等等。而如果你苦于寻找一种简单的方式来创建并且展示文本演示稿,[mdp][2] 就能帮你实现。
|
||||
|
||||
### 什么是Mdp? ###
|
||||
|
||||
mdp是Linux下一款基于ncurses的命令行演示工具。我喜欢mdp在于它对[markdown][3]的支持,使得我很容易以熟悉的markdown格式来创建幻灯片。自然,它还可以很轻松地用HTML格式来发布幻灯片。另一个好处是它支持UTF-8字符编码,这让非英语字符(如希腊或西里尔字母)的展示也变得很方便。
|
||||
|
||||
### 在Linux中安装Mdp ###
|
||||
|
||||
mdp的依赖需求很少(如 ncursesw),这使得安装非常简单。
|
||||
|
||||
#### Debian、Ubuntu或者它们的衍生版 ####
|
||||
|
||||
$ sudo apt-get install git gcc make libncursesw5-dev
|
||||
$ git clone https://github.com/visit1985/mdp.git
|
||||
$ cd mdp
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
#### Fedora或者CentOS/RHEL ####
|
||||
|
||||
$ sudo yum install git gcc make ncurses-devel
|
||||
$ git clone https://github.com/visit1985/mdp.git
|
||||
$ cd mdp
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
#### Arch Linux ####
|
||||
|
||||
Arch Linux可以通过[AUR][4]轻松安装mdp。
|
||||
|
||||
### 在命令行中创建演示稿 ###
|
||||
|
||||
安装mdp完毕,你可以使用你喜欢的文本编辑器来轻松创建一个演示稿。如果你熟悉markdown的话,很快就可以驾驭mdp。而对于那些不熟悉markdown的人来说,学习mdp最好的方式就是从一个实例着手。
|
||||
|
||||
这里有一份6页的演示稿样本可供参考。
|
||||
|
||||
%title: Sample Presentation made with mdp (Xmodulo.com)
|
||||
%author: Dan Nanni
|
||||
%date: 2015-01-28
|
||||
|
||||
-> This is a slide title <-
|
||||
=========
|
||||
|
||||
-> mdp is a command-line based presentation tool with markdown support. <-
|
||||
|
||||
*_Features_*
|
||||
|
||||
* Multi-level headers
|
||||
* Code block formatting
|
||||
* Nested quotes
|
||||
* Nested list
|
||||
* Text highlight and underline
|
||||
* Citation
|
||||
* UTF-8 special characters
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of nested list <-
|
||||
|
||||
This is an example of multi-level headers and a nested list.
|
||||
|
||||
# first-level title
|
||||
|
||||
second-level
|
||||
------------
|
||||
|
||||
- *item 1*
|
||||
- sub-item 1
|
||||
- sub-sub-item 1
|
||||
- sub-sub-item 2
|
||||
- sub-sub-item 3
|
||||
- sub-item 2
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of code block formatting <-
|
||||
|
||||
This example shows how to format a code snippet.
|
||||
|
||||
1 /* Hello World program */
|
||||
2
|
||||
3 #include <stdio.h>
|
||||
4
|
||||
5 int main()
|
||||
6 {
|
||||
7 printf("Hello World");
|
||||
8 return 0;
|
||||
9 }
|
||||
|
||||
This example shows inline code: `sudo reboot`
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of nested quotes <-
|
||||
|
||||
This is an example of nested quotes.
|
||||
|
||||
# three-level nested quotes
|
||||
|
||||
> This is the first-level quote.
|
||||
>> This is the second-level quote
|
||||
>> and continues.
|
||||
>>> *This is the third-level quote, and so on.*
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of citations <-
|
||||
|
||||
This example shows how to place a citation inside a presentation.
|
||||
|
||||
This tutorial is published at [Xmodulo](http://xmodulo.com)
|
||||
|
||||
You are welcome to connect with me at [LinkedIn](http://www.linkedin.com/in/xmodulo)
|
||||
|
||||
Pretty cool, huh?
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of UTF-8 special characters <-
|
||||
|
||||
This example shows UTF-8 special characters.
|
||||
|
||||
ae = ä, oe = ö, ue = ü, ss = ß
|
||||
alpha = ?, beta = ?, upsilon = ?, phi = ?
|
||||
Omega = ?, Delta = ?, Sigma = ?
|
||||
|
||||
???????????
|
||||
?rectangle?
|
||||
???????????
|
||||
|
||||
### 在命令行中展示演示稿 ###
|
||||
|
||||
当你把以上代码保存为slide.md的文本文件后,你可以运行以下命令来展示演示稿:
|
||||
|
||||
$ mdp slide.md
|
||||
|
||||
你可以通过按键 回车/空格/下翻页/向下光标键 (下一张幻灯)、回退/上翻页/向上光标键 (上一张幻灯)、Home (幻灯首页)、 End (幻灯末页)或者 数字N (第N页幻灯)来操作你的演示稿。
|
||||
|
||||
演示稿的标题将在每页幻灯的顶部展示,而你的名字和页码则会出现在幻灯的底部。
|
||||
|
||||

|
||||
|
||||
这是嵌套列表和多层次标题的实例效果。
|
||||
|
||||

|
||||
|
||||
这是代码片段和内联代码的实例效果。
|
||||
|
||||

|
||||
|
||||
这是嵌套引用的实例效果。
|
||||
|
||||

|
||||
|
||||
这是放置引文的实例效果。
|
||||
|
||||

|
||||
|
||||
这是UTF-8编码特殊字符支持的实例效果。
|
||||
|
||||

|
||||
|
||||
### 总结 ###
|
||||
|
||||
在本教程中,我演示了在命令行中如何使用mdp来创建并且展示一个演示稿。mdp的markdown兼容性让我们省去了学习其它新格式的麻烦,这相对于另一种名为[tpp][5]的演示工具来说是一个优势。拘于mdp的局限性,它可能无法作为你的默认演示工具。但是,值得肯定的是它一定能在某个场合下派上用场。你觉得mdp怎么样呢?你还喜欢其它的什么东西吗?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/presentation-command-line-linux.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[soooogreen](https://github.com/soooogreen)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://xmodulo.com/author/nanni
|
||||
[1]:http://bartaz.github.io/impress.js/
|
||||
[2]:https://github.com/visit1985/mdp
|
||||
[3]:http://daringfireball.net/projects/markdown/
|
||||
[4]:https://aur.archlinux.org/packages/mdp-git/
|
||||
[5]:http://www.ngolde.de/tpp.html
|
@ -1,6 +1,6 @@
|
||||
如何在Linux中安装Go语言
|
||||
================================================================================
|
||||
Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几个设计原则:简单、安全、速度。Go语言发行版拥有各种调试、测试、调优和代码审查工具。如今Go语言和它的工具链在大多数Linux发行版的基础仓库都有了,用默认的包管理器就可以安装。
|
||||
Go (也叫 "golang")是一款由Google最初开发的编程语言。它的诞生有几个设计原则:简单、安全、速度。Go语言发行版拥有各种调试、测试、调优和代码审查工具。如今Go语言和它的工具链在大多数Linux发行版的基础仓库都可用,用默认的包管理器就可以安装。
|
||||
|
||||
### 在Ubuntu、Debian 或者 Linux Mint上安装Go语言 ###
|
||||
|
||||
@ -16,7 +16,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几
|
||||
|
||||
go version go1.2.1 linux/amd64
|
||||
|
||||
按照你的需要,你或许想要使用apt-get安装额外的Go工具。
|
||||
根据你的需要,你或许想要使用apt-get安装额外的Go工具。
|
||||
|
||||
$ sudo apt-cache search golang
|
||||
|
||||
@ -36,7 +36,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几
|
||||
|
||||
go version go1.3.3 linux/amd64
|
||||
|
||||
按照你的需要,你或许想要使用yum安装额外的Go工具。
|
||||
根据你的需要,你或许想要使用yum安装额外的Go工具。
|
||||
|
||||
$ yum search golang
|
||||
|
||||
@ -44,7 +44,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几
|
||||
|
||||
### 从官网安装Go语言 ###
|
||||
|
||||
有时发行版中的版本并不是最新的。为防这样,你可以从官网安装最新的Go语言。下面是步骤。
|
||||
有时发行版中的go语言版本并不是最新的。为了避免这种情况,你可以从官网安装最新的Go语言。下面是步骤。
|
||||
|
||||
进入Go语言的[官方源码][1],并下载预编译二进制代码。
|
||||
|
||||
@ -68,7 +68,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几
|
||||
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
|
||||
如果你在/usr/local之外安装了了Go,你同样需要设置GOROOT环境变量来指向自定义的安装位置。
|
||||
如果你在/usr/local之外的自定义位置中安装了Go,你同样需要设置GOROOT环境变量来指向自定义的安装位置。
|
||||
|
||||
$ sudo vi /etc/profile
|
||||
|
||||
@ -89,7 +89,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几
|
||||
via: http://ask.xmodulo.com/install-go-language-linux.html
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[Caroline](https://github.com/carolinewuyan)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
32
sources/news/20150209 CrunchBang Linux Is Dead.md
Normal file
32
sources/news/20150209 CrunchBang Linux Is Dead.md
Normal file
@ -0,0 +1,32 @@
|
||||
CrunchBang Linux Is Dead!!!
|
||||
================================================================================
|
||||

|
||||
|
||||
Yes! You read it correct. The minimalist Linux distribution **CrunchBang Linux has been discontinued**.
|
||||
|
||||
CrunchBang Linux, popularly known for its abbreviated symbol #!, is based on Debian and comes with [Openbox][1] window manager. The dark themed Linux was/is a popular Linux choice for many experience Linux users.
|
||||
|
||||
### CrunchBang discontinued for “it no longer holds any value” ###
|
||||
|
||||
[Announcing][2] that CrunchBang will no longer be developed, head of the project Philip Newborough said that when he started the project, Linux world was different place. He mentioned that there was no ‘competition’ in the same ilk at that time but with the advancement of Linux distros like Lubuntu, Crunchbang doesn’t hold the same value.
|
||||
|
||||
> For anyone who has been involved with Linux for the past ten years or so, I’m sure they’ll agree that things have moved on. Whilst some things have stayed exactly the same, others have changed beyond all recognition. It’s called progress, and for the most part, progress is a good thing. That said, when progress happens, some things get left behind, and for me, CrunchBang is something that I need to leave behind. I’m leaving it behind because I honestly believe that it no longer holds any value, and whilst I could hold on to it for sentimental reasons, I don’t believe that would be in the best interest of its users, who would benefit from using vanilla Debian.
|
||||
|
||||
### What after CrunchBang demise? ###
|
||||
|
||||
As happened in case of [Pear OS][3], CrunchBang forums will stay online. Downloads are available for now but will be removed in near future. Philip mentioned that he was excited about some of his incoming projects and his day job. I wish him luck in his future endeavors. It is sad to see the death of a nice Linux distribution like CrunchBang.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/crunchbang-linux-dead/
|
||||
|
||||
作者:[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://en.wikipedia.org/wiki/Openbox
|
||||
[2]:http://crunchbang.org/forums/viewtopic.php?id=38916
|
||||
[3]:http://itsfoss.com/pear-os-history/
|
@ -1,3 +1,4 @@
|
||||
Translating by ZTinoZ
|
||||
What is a good IDE for C/C++ on Linux
|
||||
================================================================================
|
||||
"A real coder doesn't use an IDE, a real coder uses [insert a text editor name here] with such and such plugins." We all heard that somewhere. Yet, as much as one can agree with that statement, an IDE remains quite useful. An IDE is easy to set up and use out of the box. Hence there is no better way to start coding a project from scratch. So for this post, let me present you with my list of good IDEs for C/C++ on Linux. Why is C/C++ specifically? Because C is my favorite language, and we need to start somewhere. Also note that there are in general a lot of ways to code in C, so in order to trim down the list, I only selected "real out-of-the-box IDE", not text editors like Gedit or Vim pumped with [plugins][1]. Not that this alternative is bad in any way, just that the list will go on forever if I include text editors.
|
||||
|
24
sources/share/20150209 Non-Linux FOSS--Homebrew.md
Normal file
24
sources/share/20150209 Non-Linux FOSS--Homebrew.md
Normal file
@ -0,0 +1,24 @@
|
||||
Non-Linux FOSS: Homebrew
|
||||
================================================================================
|
||||
I use OS X quite often during my day job. I'm able to tolerate it largely due to the terminal. If I couldn't do my work with green text on a black background, I think I'd go crazy (or crazier). Unfortunately, OS X doesn't come with all the command-line tools I need. That's where Homebrew comes in to save the day.
|
||||
|
||||

|
||||
|
||||
Homebrew acts like the package management system OS X is lacking. Using commands very similar to apt-get, it allows the installation of hundreds of applications. A perfect example is the wget program. I was surprised to find that OS X doesn't include wget, but with Homebrew, it's a simple one-liner away.
|
||||
|
||||
The best part is that Homebrew installs everything in the /usr/local file space. There's no reason to worry about Homebrew corrupting your system, because it doesn't touch anything outside of /usr/local. OS X system updates won't overwrite your programs, and because /usr/local/bin is already in the PATH, installed Homebrew apps just work!
|
||||
|
||||
Homebrew uses Ruby to manage its packages and functions, but it doesn't require any programming knowledge to use. And the installation procedure is literally a copy/paste on the command line. If you use OS X, but you wish you could install packages as easily as in Linux, give Homebrew a try: [http://brew.sh][1].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxjournal.com/content/non-linux-foss-homebrew
|
||||
|
||||
作者:[Shawn Powers][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.linuxjournal.com/users/shawn-powers
|
||||
[1]:http://brew.sh/
|
@ -1,147 +0,0 @@
|
||||
[bazz2222222]
|
||||
How to Configure Chroot Environment in Ubuntu 14.04
|
||||
================================================================================
|
||||
There are many instances when you may wish to isolate certain applications, user, or environments within a Linux system. Different operating systems have different methods of achieving isolation, and in Linux, a classic way is through a `chroot` environment.
|
||||
|
||||
In this guide, we'll show you step wise on how to setup an isolated environment using chroot in order to create a barrier between your regular operating system and a contained environment. This is mainly useful for testing purposes. We will teach you the steps on an **Ubuntu 14.04** VPS instance.
|
||||
|
||||
Most system administrators will benefit from knowing how to accomplish a quick and easy chroot environment and it is a valuable skill to have.
|
||||
|
||||
### The chroot environment ###
|
||||
|
||||
A chroot environment is an operating system call that will change the root location temporarily to a new folder. Typically, the operating system's conception of the root directory is the actual root located at "/". However, with `chroot`, you can specify another directory to serve as the top-level directory for the duration of a chroot.
|
||||
|
||||
Any applications that are run from within the `chroot` will be unable to see the rest of the operating system in principle.
|
||||
|
||||
#### Advantages of Chroot Environment ####
|
||||
|
||||
> - Test applications without the risk of compromising the entire host system.
|
||||
>
|
||||
> - From the security point of view, whatever happens in the chroot environment won't affect the host system (not even under root user).
|
||||
>
|
||||
> - A different operating system running in the same hardware.
|
||||
|
||||
For instance, it allows you to build, install, and test software in an environment that is separated from your normal operating system. It could also be used as a method of **running 32-bit applications in a 64-bit environment**.
|
||||
|
||||
But while chroot environments will certainly make additional work for an unprivileged user, they should be considered a hardening feature instead of a security feature, meaning that they attempt to reduce the number of attack vectors instead of creating a full solution. If you need full isolation, consider a more complete solution, such as Linux containers, Docker, vservers, etc.
|
||||
|
||||
### Debootstrap and Schroot ###
|
||||
|
||||
The necessary packages to setup the chroot environment are **debootstrap** and **schroot**, which are available in the ubuntu repository. The schroot command is used to setup the chroot environment.
|
||||
|
||||
**Debootstrap** allows you to install a new fresh copy of any Debian (or debian-based) system from a repository in a directory with all the basic commands and binaries needed to run a basic instance of the operating system.
|
||||
|
||||
The **schroot** allows access to chroots for normal users using the same mechanism, but with permissions checking and allowing additional automated setup of the chroot environment, such as mounting additional filesystems and other configuration tasks.
|
||||
|
||||
These are the steps to implement this functionality in Ubuntu 14.04 LTS:
|
||||
|
||||
### 1. Installing the Packages ###
|
||||
|
||||
Firstly, We're gonna install debootstrap and schroot in our host Ubuntu 14.04 LTS.
|
||||
|
||||
$ sudo apt-get install debootstrap
|
||||
$ sudo apt-get install schroot
|
||||
|
||||
### 2. Configuring Schroot ###
|
||||
|
||||
Now that we have the appropriate tools, we just need to specify a directory that we want to use as our chroot environment. We will create a directory called linoxide in our root directory to setup chroot there:
|
||||
|
||||
sudo mkdir /linoxide
|
||||
|
||||
We have to configure schroot to suit our needs in the configuration file .we will modify the schroot configuration file with the information we require to get configured.
|
||||
|
||||
sudo nano /etc/schroot/schroot.conf
|
||||
|
||||
We are on an Ubuntu 14.04 LTS (Trusty Tahr) system currently, but let's say that we want to test out some packages available on Ubuntu 13.10, code named "Saucy Salamander". We can do that by creating an entry that looks like this:
|
||||
|
||||
[saucy]
|
||||
description=Ubuntu Saucy
|
||||
location=/linoxide
|
||||
priority=3
|
||||
users=arun
|
||||
root-groups=root
|
||||
|
||||

|
||||
|
||||
Modify the values of the configuration parameters in the above example to fit your system:
|
||||
|
||||
### 3. Installing 32 bit Ubuntu with debootstrap ###
|
||||
|
||||
Debootstrap downloads and installs a minimal operating system inside your **chroot environment**. You can install any debian-based distro of your choice, as long as you have a repository available.
|
||||
|
||||
Above, we placed the chroot environment under the directory **/linoxide** and this is the root directory of the chroot environment. So we'll need to run debootstrap inside that directory which we have already created:
|
||||
|
||||
cd /linoxide
|
||||
sudo debootstrap --variant=buildd --arch amd64 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/
|
||||
sudo chroot /linoxide /debootstrap/debootstrap --second-stage
|
||||
|
||||
You can replace amd64 in --arch as i386 or other bit OS you wanna setup available in the repository. You can replace the mirror http://archive.ubuntu.com/ubuntu/ above as the one closest, you can get the closest one from the official [Ubuntu Mirror Page][1].
|
||||
|
||||
**Note: You will need to add --foreign above 3rd line command if you choose to setup i386 bit OS choot in your 64 bit Host Ubuntu as:**
|
||||
|
||||
sudo debootstrap --variant=buildd --foreign --arch i386 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/
|
||||
|
||||
It takes some time (depending on your bandwidth) to download, install and configure the complete system. It takes about 500 MBs for a minimal installation.
|
||||
|
||||
### 4. Finallizing the chroot environment ###
|
||||
|
||||
After the system is installed, we'll need to do some final configurations to make sure the system functions correctly. First, we'll want to make sure our host `fstab` is aware of some pseudo-systems in our guest.
|
||||
|
||||
sudo nano /etc/fstab
|
||||
|
||||
Add the below lines like these to the bottom of your fstab:
|
||||
|
||||
proc /linoxide/proc proc defaults 0 0
|
||||
sysfs /linoxide/sys sysfs defaults 0 0
|
||||
|
||||
Save and close the file.
|
||||
|
||||
Now, we're going to need to mount these filesystems within our guest:
|
||||
|
||||
$ sudo mount proc /linoxide/proc -t proc
|
||||
$sudo mount sysfs /linoxide/sys -t sysfs
|
||||
|
||||
We'll also want to copy our /etc/hosts file so that we will have access to the correct network information:
|
||||
|
||||
$ sudo cp /etc/hosts /linoxide/etc/hosts
|
||||
|
||||
Finally, You can list the available chroot environments using the schroot command.
|
||||
|
||||
$ schroot -l
|
||||
|
||||
We can enter the chroot environment through a command like this:
|
||||
|
||||
$ sudo chroot /linoxide/ /bin/bash
|
||||
|
||||
You can test the chroot environment by checking the version of distributions installed.
|
||||
|
||||
# lsb_release -a
|
||||
# uname -a
|
||||
|
||||
To finish this tutorial, in order to run a graphic application from the chroot, you have to export the DISPLAY environment variable.
|
||||
|
||||
$ DISPLAY=:0.0 ./apps
|
||||
|
||||
Here, we have successfully installed Chrooted Ubuntu 13.10(Saucy Salamander) in your host Ubuntu 14.04 LTS (Trusty Tahr).
|
||||
|
||||
You can exit chroot environment successfully by running the commands below:
|
||||
|
||||
# exit
|
||||
|
||||
Afterwards, we need to unmount our proc and sys filesystems:
|
||||
|
||||
$ sudo umount /test/proc
|
||||
$ sudo umount /test/sys
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/ubuntu-how-to/configure-chroot-environment-ubuntu-14-04/
|
||||
|
||||
作者:[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]:https://launchpad.net/ubuntu/+archivemirrors
|
@ -1,3 +1,4 @@
|
||||
translating by soooogreen
|
||||
Improve system performance by moving your log files to RAM Using Ramlog
|
||||
================================================================================
|
||||
Ramlog act as a system daemon. On startup it creates ramdisk, it copies files from /var/log into ramdisk and mounts ramdisk as /var/log. All logs after that will be updated on ramdisk. Logs on harddrive are kept in folder /var/log.hdd which is updated when ramlog is restarted or stopped. On shutdown it saves log files back to harddisk so logs are consistent. Ramlog 2.x is using tmpfs by default, ramfs and kernel ramdisk are suppored as well. Program rsync is used for log synchronization.
|
||||
@ -109,4 +110,4 @@ via: http://www.ubuntugeek.com/improve-system-performance-by-moving-your-log-fil
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.ubuntugeek.com/author/ubuntufix
|
||||
[1]:http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb
|
||||
[1]:http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb
|
||||
|
@ -1,82 +0,0 @@
|
||||
Translating by mtunique
|
||||
Moving to Docker
|
||||
================================================================================
|
||||

|
||||
|
||||
[TL;DR] This is the first post in a series of 3 on how my company moved its infrastructure from PaaS to Docker based deployment. If you want, you can skip the intro (this post) and head directly to the technical topics (links at the bottom of the page).
|
||||
|
||||
----------
|
||||
|
||||
In the last month I've been strggling with devops. This is my very personal story and experience in trying to streamline a deployment process of a Raila app with Docker.
|
||||
|
||||
When I started my company – [Touchware][1] – in 2012 I was a lone developer. Things were small, uncomplicated, they didn't require a lot of maintenance, nor they needed to scale all that much. During the course of last year though, we grew quite a lot (we are now a team of 10 people) and our server-side applications and API grew both in terms of scope and scale.
|
||||
|
||||
### Step 1 - Heroku ###
|
||||
|
||||
We still are a very small team and we need to make things going and run as smoothly as possible. When we looked for possible solutions, we decided to stick with something that would have removed from our shoulders the burden of managing hardware. Since we develop mainly Rails based applications and Heroku has a great support for RoR and various kind of DBs and cached (Postgres / Mongo / Redis etc.), the smartest choice seemed to be going with [Heroku][2]. And that's what we did.
|
||||
|
||||
Heroku has a great support and great documentation and deploying apps is just so snappy! Only problem is, when you start growing, you need to have piles of cash around to pay the bills. Not the best deal, really.
|
||||
|
||||
### Step 2 - Dokku ###
|
||||
|
||||
In a rush to try and cut the costs, we decided to try with Dokku. [Dokku][3], quoting the Github repo is a
|
||||
|
||||
> Docker powered mini-Heroku in around 100 lines of Bash
|
||||
|
||||
We launched some instances on [DigitalOcean][4] with Dokku pre-installed and we gave it spin. Dokku is very much like Heroku, but when you have complex applications for whom you need to twear params, or where you need certain dependencies, it's just not gonna work out. We had an app where we needed to apply multiple transformations on images and we couldn't find a way to install the correct version of imagemagick into the dokku-based Docker container that was hosting our Rails app. We still have a couple of very simple apps that are running on Dokku, but we had to move some of them back to Heroku.
|
||||
|
||||
### Step 3 - Docker ###
|
||||
|
||||
A couple of months ago, since the problem of devops and managing production apps was resurfacing, I decided to try out [Docker][5]. Docker, in simple terms, allows developers to containerize applications and to ease the deployment. Since a Docker container basically has all the dependencies it needs to run your app, if everything runs fine on your laptop, you can be sure it'll also run like a champ in production on a remote server, be it an AWS E2C instance or a VPS on DigitalOcean.
|
||||
|
||||
Docker IMHO is particularly interesting for the following reasons:
|
||||
|
||||
- it promotes modularization and separation of concerns: you need to start thinking about your apps in terms of logical components (load balancer: 1 container, DB: 1 container, webapp: 1 container etc.);
|
||||
- it's very flexible in terms of deployment options: containers can be deployed to a wide variety of HW and can be easily redeployed to different servers / providers;
|
||||
- it allows for a very fine grained tuning of your app environment: you build the images your containers runs from, so you have plenty of options for configuring your environment exactly as you would like to.
|
||||
|
||||
There are howerver some downsides:
|
||||
|
||||
- the learning curve is quite steep (this is probably a very personal problem, but I'm talking as a software dev and not as a skilled operations professional);
|
||||
- setup is not simple, especially if you want to have a private registry / repository (more about this later).
|
||||
|
||||
Following are some tips I put together during the course of the last week with the findings of someone that is new to the game.
|
||||
|
||||
----------
|
||||
|
||||
In the following articles we'll see how to setup a semi-automated Docker based deployment system.
|
||||
|
||||
- [Setting up a private Docker registry][6]
|
||||
- [Configuring a Rails app for semi-automated deployment][7]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://cocoahunter.com/2015/01/23/docker-1/
|
||||
|
||||
作者:[Michelangelo Chasseur][a]
|
||||
译者:[mtunique](https://github.com/mtunique)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://cocoahunter.com/author/michelangelo/
|
||||
[1]:http://www.touchwa.re/
|
||||
[2]:http://cocoahunter.com/2015/01/23/docker-1/www.heroku.com
|
||||
[3]:https://github.com/progrium/dokku
|
||||
[4]:http://cocoahunter.com/2015/01/23/docker-1/www.digitalocean.com
|
||||
[5]:http://www.docker.com/
|
||||
[6]:http://cocoahunter.com/2015/01/23/docker-2/
|
||||
[7]:http://cocoahunter.com/2015/01/23/docker-3/
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
||||
[13]:
|
||||
[14]:
|
||||
[15]:
|
||||
[16]:
|
||||
[17]:
|
||||
[18]:
|
||||
[19]:
|
||||
[20]:
|
@ -1,187 +0,0 @@
|
||||
translating by soooogreen
|
||||
How to create and show a presentation from the command line on Linux
|
||||
================================================================================
|
||||
When you prepare a talk for audience, the first thing that will probably come to your mind is shiny presentation charts filled with fancy diagrams, graphics and animation effects. Fine. No one can deny the power of visually charming presentation. However, not all presentations need to be Ted talk quality. Often times, the purpose of a presentation is to convey specific information, which can easily be done with textual messages. In such cases, your time can be better spent on gathering information and checking facts, rather than searching for good-looking graphics from Google Image.
|
||||
|
||||
In the world of Linux, you can do presentation in several different ways, e.g., Impress for multimedia-rich content, [Impress.js][1] for stunning visualization, Beamer for hardcore LaTex users, and so on. If you are looking for a simple means to create and show a textual presentation, look no further. [mdp][2] can get the job done for you.
|
||||
|
||||
### What is Mdp? ###
|
||||
|
||||
mdp is an ncurses-based command-line presentation tool for Linux. What I like about mdp is its [markdown][3] support, which makes it easy to create slides with familiar markdown format. Naturally, it becomes painless to publish the slides in HTML format as well. Another plus is its support for UTF-8 character encoding, which comes in handy when showing non-English characters (e.g., Greek or Cyrillic alphabets).
|
||||
|
||||
### Install Mdp on Linux ###
|
||||
|
||||
Installation of mdp is mostly painless due to its light dependency requirement (i.e., ncursesw).
|
||||
|
||||
#### Debian, Ubuntu or their derivatives ####
|
||||
|
||||
$ sudo apt-get install git gcc make libncursesw5-dev
|
||||
$ git clone https://github.com/visit1985/mdp.git
|
||||
$ cd mdp
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
#### Fedora or CentOS/RHEL ####
|
||||
|
||||
$ sudo yum install git gcc make ncurses-devel
|
||||
$ git clone https://github.com/visit1985/mdp.git
|
||||
$ cd mdp
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
#### Arch Linux ####
|
||||
|
||||
On Arch Linux, you can easily install mdp from [AUR][4].
|
||||
|
||||
### Create a Presentation from the Command Line ###
|
||||
|
||||
Once you installed mdp, you can easily create a presentation by using your favorite text editor. If you are familiar with markdown, it will take no time to master mdp. For those of you who are not familiar with markdown, starting with an example is the best way to learn mdp.
|
||||
|
||||
Here is a 6-page sample presentation for your reference.
|
||||
|
||||
%title: Sample Presentation made with mdp (Xmodulo.com)
|
||||
%author: Dan Nanni
|
||||
%date: 2015-01-28
|
||||
|
||||
-> This is a slide title <-
|
||||
=========
|
||||
|
||||
-> mdp is a command-line based presentation tool with markdown support. <-
|
||||
|
||||
*_Features_*
|
||||
|
||||
* Multi-level headers
|
||||
* Code block formatting
|
||||
* Nested quotes
|
||||
* Nested list
|
||||
* Text highlight and underline
|
||||
* Citation
|
||||
* UTF-8 special characters
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of nested list <-
|
||||
|
||||
This is an example of multi-level headers and a nested list.
|
||||
|
||||
# first-level title
|
||||
|
||||
second-level
|
||||
------------
|
||||
|
||||
- *item 1*
|
||||
- sub-item 1
|
||||
- sub-sub-item 1
|
||||
- sub-sub-item 2
|
||||
- sub-sub-item 3
|
||||
- sub-item 2
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of code block formatting <-
|
||||
|
||||
This example shows how to format a code snippet.
|
||||
|
||||
1 /* Hello World program */
|
||||
2
|
||||
3 #include <stdio.h>
|
||||
4
|
||||
5 int main()
|
||||
6 {
|
||||
7 printf("Hello World");
|
||||
8 return 0;
|
||||
9 }
|
||||
|
||||
This example shows inline code: `sudo reboot`
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of nested quotes <-
|
||||
|
||||
This is an example of nested quotes.
|
||||
|
||||
# three-level nested quotes
|
||||
|
||||
> This is the first-level quote.
|
||||
>> This is the second-level quote
|
||||
>> and continues.
|
||||
>>> *This is the third-level quote, and so on.*
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of citations <-
|
||||
|
||||
This example shows how to place a citation inside a presentation.
|
||||
|
||||
This tutorial is published at [Xmodulo](http://xmodulo.com)
|
||||
|
||||
You are welcome to connect with me at [LinkedIn](http://www.linkedin.com/in/xmodulo)
|
||||
|
||||
Pretty cool, huh?
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
-> # Example of UTF-8 special characters <-
|
||||
|
||||
This example shows UTF-8 special characters.
|
||||
|
||||
ae = ä, oe = ö, ue = ü, ss = ß
|
||||
alpha = ?, beta = ?, upsilon = ?, phi = ?
|
||||
Omega = ?, Delta = ?, Sigma = ?
|
||||
|
||||
???????????
|
||||
?rectangle?
|
||||
???????????
|
||||
|
||||
### Show a Presentation from the Command Line ###
|
||||
|
||||
Once you save the above code as slide.md text file, you can show the presentation by simply running:
|
||||
|
||||
$ mdp slide.md
|
||||
|
||||
You can navigate the presentation by pressing Enter/Space/Page-Down/Down-Arrow (next slide), Backspace/Page-Up/Up-Arrow (previous slide), Home (first slide), End (last slide), or numeric-N (N-th slide).
|
||||
|
||||
The title of the presentation appears on top of each slide, and your name and page number are shown at the bottom.
|
||||
|
||||

|
||||
|
||||
This is an example of a nested list and multi-level headers.
|
||||
|
||||

|
||||
|
||||
This is an example of a code snippet and inline code.
|
||||
|
||||

|
||||
|
||||
This is an example of nested quotes.
|
||||
|
||||

|
||||
|
||||
This is an example of placing citations.
|
||||
|
||||

|
||||
|
||||
This is an example of UTF-8 special characters.
|
||||
|
||||

|
||||
|
||||
### Summary ###
|
||||
|
||||
In this tutorial, I showed you how to use mdp to create and show a presentation from the command line. Its markdown compatibility saves us the trouble and hassle of having to learn any new formatting, which is an advantage compared to [tpp][5], another command-line presentation tool. Due to its limitations, mdp may not qualify as your default presentation tool, but there should be definitely a use case for that. What do you think of mdp? Do you prefer something else?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/presentation-command-line-linux.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://bartaz.github.io/impress.js/
|
||||
[2]:https://github.com/visit1985/mdp
|
||||
[3]:http://daringfireball.net/projects/markdown/
|
||||
[4]:https://aur.archlinux.org/packages/mdp-git/
|
||||
[5]:http://www.ngolde.de/tpp.html
|
@ -0,0 +1,106 @@
|
||||
How to access Feedly RSS feed from the command line on Linux
|
||||
================================================================================
|
||||
In case you didn't know, [Feedly][1] is one of the most popular online news aggregation services. It offers seamlessly unified news reading experience across desktops, Android and iOS devices via browser extensions and mobile apps. Feedly took on the demise of Google Reader in 2013, quickly gaining a lot of then Google Reader users. I was one of them, and Feedly has remained my default RSS reader since then.
|
||||
|
||||
While I appreciate the sleek interface of Feedly's browser extensions and mobile apps, there is yet another way to access Feedly: Linux command-line. That's right. You can access Feedly's news feed from the command line. Sounds geeky? Well, at least for system admins who live on headless servers, this can be pretty useful.
|
||||
|
||||
Enter [Feednix][2]. This open-source software is a Feedly's unofficial command-line client written in C++. It allows you to browse Feedly's news feed in ncurses-based terminal interface. By default, Feednix is linked with a console-based browser called w3m to allow you to read articles within a terminal environment. You can choose to read from your favorite web browser though.
|
||||
|
||||
In this tutorial, I am going to demonstrate how to install and configure Feednix to access Feedly from the command line.
|
||||
|
||||
### Install Feednix on Linux ###
|
||||
|
||||
You can build Feednix from the source using the following instructions. At the moment, the "Ubuntu-stable" branch of the official Github repository has the most up-to-date code. So let's use this branch to build it.
|
||||
|
||||
As prerequisites, you will need to install a couple of development libraries, as well as w3m browser.
|
||||
|
||||
#### Debian, Ubuntu or Linux Mint ####
|
||||
|
||||
$ sudo apt-get install git automake g++ make libncursesw5-dev libjsoncpp-dev libcurl4-gnutls-dev w3m
|
||||
$ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git
|
||||
$ cd Feednix
|
||||
$ ./autogen.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
#### Fedora ####
|
||||
|
||||
$ sudo yum groupinstall "C Development Tools and Libraries"
|
||||
$ sudo yum install gcc-c++ git automake make ncurses-devel jsoncpp-devel libcurl-devel w3m
|
||||
$ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git
|
||||
$ cd Feednix
|
||||
$ ./autogen.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
Arch Linux
|
||||
|
||||
On Arch Linux, you can easily install Feednix from [AUR][3].
|
||||
|
||||
### Configure Feednix for the First Time ###
|
||||
|
||||
After installing it, launch Feednix as follows.
|
||||
|
||||
$ feednix
|
||||
|
||||
The first time you run Feednix, it will pop up a web browser window, where you need to sign up to create a Feedly's user ID and its corresponding developer access token. If you are running Feednix in a desktop-less environment, open a web browser on another computer, and go to https://feedly.com/v3/auth/dev.
|
||||
|
||||

|
||||
|
||||
Once you sign in, you will see your Feedly user ID generated.
|
||||
|
||||

|
||||
|
||||
To retrieve an access token, you need to follow the token link sent to your email address in your browser. Only then will you see the window showing your user ID, access token, and its expiration date. Be aware that access token is quite long (more than 200 characters). The token appears in a horizontally scrollable text box, so make sure to copy the whole access token string.
|
||||
|
||||

|
||||
|
||||
Paste your user ID and access token into the Feednix' command-line prompt.
|
||||
|
||||
[Enter User ID] >> XXXXXX
|
||||
[Enter token] >> YYYYY
|
||||
|
||||
After successful authentication, you will see an initial Feednix screen with two panes. The left-side "Categories" pane shows a list of news categories, while the right-side "Posts" pane displays a list of news articles in the current category.
|
||||
|
||||

|
||||
|
||||
### Read News in Feednix ###
|
||||
|
||||
Here I am going to briefly describe how to access Feedly via Feednix.
|
||||
|
||||
#### Navigate Feednix ####
|
||||
|
||||
As I mentioned, the top screen of Feednix consists of two panes. To switch focus between the two panes, use TAB key. To move up and down the list within a pane, use 'j' and 'k' keys, respectively. These keyboard shorcuts are obviously inspired by Vim text editor.
|
||||
|
||||
#### Read an Article ####
|
||||
|
||||
To read a particular article, press 'o' key at the current article. It will invoke w2m browser, and load the article inside the browser. Once you are done reading, press 'q' to quit the browser, and come back to Feednix. If your environment can open a web browser, you can press 'O' to load an article on your default web browser such as Firefox.
|
||||
|
||||

|
||||
|
||||
#### Subscribe to a News Feed ####
|
||||
|
||||
You can add any arbitrary RSS news feed to your Feedly account from Feednix interface. To do so, simply press 'a' key. This will show "[ENTER FEED]:" prompt at the bottom of the screen. After typing the RSS feed, go ahead and fill in the name of the feed and its preferred category.
|
||||
|
||||

|
||||
|
||||
#### Summary ####
|
||||
|
||||
As you can see, Feednix is a quite convenient and easy-to-use command-line RSS reader. If you are a command-line junkie as well as a regular Feedly user, Feednix is definitely worth trying. I have been communicating with the creator of Feednix, Jarkore, to troubleshoot some issue. As far as I can tell, he is very active in responding to bug reports and fixing bugs. I encourage you to try out Feednix and let him know your feedback.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/feedly-rss-feed-command-line-linux.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]:https://feedly.com/
|
||||
[2]:https://github.com/Jarkore/Feednix
|
||||
[3]:https://aur.archlinux.org/packages/feednix/
|
@ -0,0 +1,111 @@
|
||||
How to back up a Debian system using backupninja
|
||||
================================================================================
|
||||
Prudence or experience by disaster can teach every [sysadmin][1] the importance of taking frequent system backups. You can do so by writing good old shell scripts, or using one (or more) of the many backup tools available for the job. Thus the more tools you become acquainted with, the better informed decisions you will make when implementing a backup solution.
|
||||
|
||||
In this article we will present [backupninja][2], a lightweight and easy-to-configure system backup tool. With the help of programs like **rdiff-backup**, **duplicity**, **mysqlhotcopy** and **mysqldump**, Backupninja offers common backup features such as remote, secure and incremental file system backups, encrypted backup, and MySQL/MariaDB database backup. You can selectively enable status email reports, and can back up general hardware and system information as well. One key strength of backupninja is a built-in console-based wizard (called **ninjahelper**) that allows you to easily create configuration files for various backup scenarios.
|
||||
|
||||
The downside, so to speak, is that backupninja requires other "helper" programs to be installed in order to take full advantage of all its features. While backupninja's RPM package is available for Red Hat-based distributions, backupninja's dependencies are optimized for Debian and its derivatives. Thus it is not recommended to try backupninja for Red Hat based systems.
|
||||
|
||||
In this tutorial, we will cover the backupninja installation for Debian-based distributions.
|
||||
|
||||
### Installing Backupninja ###
|
||||
|
||||
Run the following command as root:
|
||||
|
||||
# aptitude install backupninja
|
||||
|
||||
During installation, several files and directories will be created:
|
||||
|
||||
- **/usr/sbin/backupninja** is the main bash shell script.
|
||||
- **/etc/cron.d/backupninja**, by default, instructs cron to run the main script once per hour.
|
||||
- **/etc/logrotate.d/backupninja** rotates the logs created by the program.
|
||||
- **/etc/backup.d/** is the directory where the configuration files for backup actions reside.
|
||||
- **/etc/backupninja.conf** is the main configuration file that includes general options. It is well commented and explains each option in detail.
|
||||
- **/usr/share/backupninja** is the directory where the scripts used by backupninja are located (aka "handlers"). These are the scripts which are in charge of doing the actual work. In this directory you will also find .helper files, which are used to configure and set up ninjahelper menus.
|
||||
- **/usr/share/doc/backupninja/examples** contains templates for action configuration files (the kind of files that are created through ninjahelper).
|
||||
|
||||
### Running Ninjahelper for the First Time ###
|
||||
|
||||
When we try to launch ninjahelper, we can see that an internal dependency may be required. If prompted, enter "yes" and press the ENTER key to install dialog (a tool that displays user-friendly dialog boxes from shell scripts).
|
||||
|
||||

|
||||
|
||||
When you press Enter after typing yes, backupninja will install dialog and present the following screen once it's done.
|
||||
|
||||

|
||||
|
||||
#### Example 1: Back up Hardware and System Info ####
|
||||
|
||||
After launching ninjahelper, we will create a new backup action:
|
||||
|
||||

|
||||
|
||||
If necessary helper programs are not installed, we will be presented with the following screens. Disregard this step if these packages have already been installed on your system.
|
||||
|
||||

|
||||
|
||||
The next step consists of selecting the items that you want to be a part of this backup. The first four are selected by default, but you can deselect them by pressing the spacebar.
|
||||
|
||||

|
||||
|
||||
Once you are done, press OK to continue. You will be able to choose whether you want to use the default configuration file for this backup action (/etc/backup.d/10.sys), or if you want to create a new one. In the latter case, a new file with the same contents as the default one will be created under the same directory but named 11.sys, and so on for future system backup actions. Note that you can edit the configuration file once it's created with your preferred text editor.
|
||||
|
||||

|
||||
|
||||
#### Example 2: Incremental Rsync Pull Backup of a Remote Directory ####
|
||||
|
||||
As you most likely know, rsync is widely used to synchronize files and folders over a network. In the following example we will discuss an approach to take incremental pull backups of a remote directory with hardlinking to save historical data and store them in our local file server. This approach will help us save space and increase security on the server side.
|
||||
|
||||
**Step 1**: Write a custom script in the /etc/backup.d directory with the following contents and chmod it to 600. Note that this directory may contain, besides plain configuration files, scripts that you want to run when backupninja is executed, with the advantage of using variables present in the main configuration file.
|
||||
|
||||
# REMOTE USER
|
||||
user=root
|
||||
# REMOTE HOST
|
||||
host=dev1
|
||||
# REMOTE DIRECTORY
|
||||
remotedir=/home/gacanepa/
|
||||
# LOCAL DIRECTORY
|
||||
localdir=/home/gacanepa/backup.0
|
||||
# LOCAL DIRECTORY WHERE PREVIOUS BACKUP WAS STORED
|
||||
localdirold=/home/gacanepa/backup.1
|
||||
mv $localdir $localdirold
|
||||
# RSYNC
|
||||
rsync -av --delete --recursive --link-dest=$localdirold $user@$host:$remotedir $localdir
|
||||
|
||||
In the above configuration, the '--link-dest' option of rsync is use to hardlink unchanged files (in all attributes) from $localdir-old to the destination directory ($localdir).
|
||||
|
||||
**Step 2**: Before backupninja is run for the first time, the parent directory (/home/gacanepa in this case) is empty. The first time we execute:
|
||||
|
||||
# backupninja -n
|
||||
|
||||
the backup.0 directory is created, and later in the process its name is changed to backup.1.
|
||||
|
||||
The second time we run backupninja, backup.0 is re-created and backup.1 is kept.
|
||||
|
||||

|
||||
|
||||
**Step 3**: Verify that the contents of backup.1 are hard links to the files in backup.0 by comparing the respective inode numbers and directory sizes.
|
||||
|
||||

|
||||
|
||||
### Conclusion ###
|
||||
|
||||
Backupninja is not only a classic backup tool, but also an easy-to-configure utility. You can write your own handlers to run backupninja as per the individual configuration files located in /etc/backup.d, and you can even write helpers for ninjahelper in order to include them in its main interface.
|
||||
|
||||
For example, if you create a handler named xmodulo in /usr/share/backupninja, it will run by default every file with the .xmodulo extension in /etc/backup.d. If you decide you want to add your xmodulo handler to ninjahelper, you can write the corresponding helper as xmodulo.helper. In addition, if you want backupninja to run an arbitrary script, just add it to /etc/backup.d and you are good to go.
|
||||
|
||||
Feel free to leave your comments, questions, or suggestions, using the form below. we will be more than glad to hear from you.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/backup-debian-system-backupninja.html
|
||||
|
||||
作者:[Gabriel Cánepa][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/gabriel
|
||||
[1]:http://xmodulo.com/recommend/sysadminbook
|
||||
[2]:https://labs.riseup.net/code/projects/backupninja
|
@ -0,0 +1,149 @@
|
||||
Install OpenQRM Cloud Computing Platform In Debian
|
||||
================================================================================
|
||||
### Introduction ###
|
||||
|
||||
**openQRM** is a web-based open source Cloud computing and datacenter management platform that integrates flexibly with existing components in enterprise data centers.
|
||||
|
||||
It supports the following virtualization technologies:
|
||||
|
||||
- KVM,
|
||||
- XEN,
|
||||
- Citrix XenServer,
|
||||
- VMWare ESX,
|
||||
- LXC,
|
||||
- OpenVZ.
|
||||
|
||||
The Hybrid Cloud Connector in openQRM supports a range of private or public cloud providers to extend your infrastructure on demand via **Amazon AWS**, **Eucalyptus** or **OpenStack**. It, also, automates provisioning, virtualization, storage and configuration management, and it takes care of high-availability. A self-service cloud portal with integrated billing system enables end-users to request new servers and application stacks on-demand.
|
||||
|
||||
openQRM is available in two different flavours such as:
|
||||
|
||||
- Enterprise Edition
|
||||
- Community Edition
|
||||
|
||||
You can view the difference between both editions [here][1].
|
||||
|
||||
### Features ###
|
||||
|
||||
- Private/Hybrid Cloud Computing Platform;
|
||||
- Manages physical and virtualized server systems;
|
||||
- Integrates with all major open and commercial storage technologies;
|
||||
- Cross-platform: Linux, Windows, OpenSolaris, and *BSD;
|
||||
- Supports KVM, XEN, Citrix XenServer, VMWare ESX(i), lxc, OpenVZ and VirtualBox;
|
||||
- Support for Hybrid Cloud setups using additional Amazon AWS, Eucalyptus, Ubuntu UEC cloud resources;
|
||||
- Supports P2V, P2P, V2P, V2V Migrations and High-Availability;
|
||||
- Integrates with the best Open Source management tools – like puppet, nagios/Icinga or collectd;
|
||||
- Over 50 plugins for extended features and integration with your infrastructure;
|
||||
- Self-Service Portal for end-users;
|
||||
- Integrated billing system.
|
||||
|
||||
### Installation ###
|
||||
|
||||
Here, we will install openQRM in Ubuntu 14.04 LTS. Your server must atleast meet the following requirements.
|
||||
|
||||
- 1 GB RAM;
|
||||
- 100 GB Hdd;
|
||||
- Optional: Virtualization enabled (VT for Intel CPUs or AMD-V for AMD CPUs) in Bios.
|
||||
|
||||
First, install make package to compile openQRM source package.
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade
|
||||
sudo apt-get install make
|
||||
|
||||
Then, run the following commands one by one to install openQRM.
|
||||
|
||||
Download the latest available version [from here][2].
|
||||
|
||||
wget http://sourceforge.net/projects/openqrm/files/openQRM-Community-5.1/openqrm-community-5.1.tgz
|
||||
|
||||
tar -xvzf openqrm-community-5.1.tgz
|
||||
|
||||
cd openqrm-community-5.1/src/
|
||||
|
||||
sudo make
|
||||
|
||||
sudo make install
|
||||
|
||||
sudo make start
|
||||
|
||||
During installation, you’ll be asked to update the php.ini file.
|
||||
|
||||

|
||||
|
||||
Enter mysql root user password.
|
||||
|
||||

|
||||
|
||||
Re-enter password:
|
||||
|
||||

|
||||
|
||||
Select the mail server configuration type.
|
||||
|
||||

|
||||
|
||||
If you’re not sure, select Local only. In our case, I go with **Local only** option.
|
||||
|
||||

|
||||
|
||||
Enter your system mail name, and finally enter the Nagios administration password.
|
||||
|
||||

|
||||
|
||||
The above commands will take long time depending upon your Internet connection to download all packages required to run openQRM. Be patient.
|
||||
|
||||
Finally, you’ll get the openQRM configuration URL along with username and password.
|
||||
|
||||

|
||||
|
||||
### Configuration ###
|
||||
|
||||
After installing openQRM, open up your web browser and navigate to the URL: **http://ip-address/openqrm**.
|
||||
|
||||
For example, in my case http://192.168.1.100/openqrm.
|
||||
|
||||
The default username and password is: **openqrm/openqrm**.
|
||||
|
||||

|
||||
|
||||
Select a network card to use for the openQRM management network.
|
||||
|
||||

|
||||
|
||||
Select a database type. In our case, I selected mysql.
|
||||
|
||||

|
||||
|
||||
Now, configure the database connection and initialize openQRM. Here, I use **openQRM** as database name, and user as **root** and debian as password for the database. Be mindful that you should enter the mysql root user password that you have created while installing openQRM.
|
||||
|
||||

|
||||
|
||||
Congratulations!! openQRM has been installed and configured.
|
||||
|
||||

|
||||
|
||||
### Update openQRM ###
|
||||
|
||||
To update openQRM at any time run the following command:
|
||||
|
||||
cd openqrm/src/
|
||||
make update
|
||||
|
||||
What we have done so far is just installed and configured openQRM in our Ubuntu server. For creating, running Virtual Machines, managing Storage, integrating additional systems and running your own private Cloud, I suggest you to read the [openQRM Administrator Guide][3].
|
||||
|
||||
That’s all now. Cheers! Happy weekend!!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/install-openqrm-cloud-computing-platform-debian/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.unixmen.com/author/sk/
|
||||
[1]:http://www.openqrm-enterprise.com/products/edition-comparison.html
|
||||
[2]:http://sourceforge.net/projects/openqrm/files/?source=navbar
|
||||
[3]:http://www.openqrm-enterprise.com/fileadmin/Documents/Whitepaper/openQRM-Enterprise-Administrator-Guide-5.2.pdf
|
@ -0,0 +1,100 @@
|
||||
Translating by martin.
|
||||
|
||||
Install the Gnome Flashback classical desktop on Ubuntu 14.10/Linux Mint 17
|
||||
================================================================================
|
||||
The [Gnome Flashback][1] desktop environment is a simple and great way to get back the old style classical desktop if you do not like Unity desktop, like many.
|
||||
|
||||
Gnome Flashback is based on GTK 3 and provides a desktop interface visually similar to the old gnome desktop.
|
||||
|
||||
Another alternative to gnome flashback is the MATE desktop from linux mint and XFCE desktop, but both of them are based on gtk 2.
|
||||
|
||||
### Install Gnome Flashback ###
|
||||
|
||||
Install the following package on your Ubuntu system and you are done.
|
||||
|
||||
$ sudo apt-get install gnome-session-flashback
|
||||
|
||||
Now logout and at the login screen press the settings button on the box that asks for password. There would be 2 options, Gnome Flashback (Metacity) and Gnome Flashback (Compiz).
|
||||
|
||||
Metacity is lighter and faster, whereas Compiz gets you the more fancy desktop effects. Here is a screenshot of my gnome flashback desktop.
|
||||
|
||||
It uses a wallpaper from elementary OS and also Plank dock with no bottom panel. This tutorial explains every bit of it.
|
||||
|
||||

|
||||
|
||||
After installing Gnome Flashback desktop you need to do a couple of more things to finetune it.
|
||||
|
||||
### 1. Install Gnome Tweak Tool ###
|
||||
|
||||
The Gnome Tweak Tool allows you to customize things like fonts, themes etc, that are otherwise difficult or impossible with the "unity-control-center" tool of Unity desktop.
|
||||
|
||||
$ sudo apt-get install gnome-tweak-tool
|
||||
|
||||
Find it in Applications > System Tools > Preferences > Tweak Tool
|
||||
|
||||
### 2. Add applets to panel ###
|
||||
|
||||
By default right clicking on the panels would not have any effect. Press the Alt+Super (windows) key on your keyboard while you right click on the panels and you would get the relevant options to customize the panel.
|
||||
|
||||
You can modify the panel, remove it and also add applets to it. In this example we shall remove the bottom panel and replace it with Plank dock.
|
||||
|
||||
Add a datetime applet on the top panel at the middle. Configure it to display the date time and weather conditions.
|
||||
|
||||
Also add a workspace switcher applet to the top panel and create as many workspaces as you need.
|
||||
|
||||
### 3. Take window title bar buttons to the right ###
|
||||
|
||||
On Ubuntu the minimise, maximise and close buttons on the window title bar are on the left by default. It needs a small hack to get them to the right.
|
||||
|
||||
To take the window buttons to the right use the following command, which I found at askubuntu.
|
||||
|
||||
$ gsettings set org.gnome.desktop.wm.preferences button-layout 'menu:minimize,maximize,close'
|
||||
|
||||
### 4. Install Plank dock ###
|
||||
|
||||
The plank dock sits at the bottom and holds launchers for applications and window launchers for running applications. It hides itself when not necessary and shows up again when needed. Its the same dock as used by elementary OS.
|
||||
|
||||
Run the following commands
|
||||
|
||||
$ sudo add-apt-repository ppa:ricotz/docky -y
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install plank -y
|
||||
|
||||
Find it in Applications > Accessories > Plank. To configure it to start automatically with the system, go to System Tools > Preferences > Startup Applications and add the "plank" command to the list.
|
||||
|
||||
### 5. Install Conky system monitor ###
|
||||
|
||||
Conky is a nice way to decorate your desktop with system statistics like cpu and memory usage. It is lightweight and works most of the time without any hassles.
|
||||
|
||||
Run the following commands -
|
||||
|
||||
$ sudo apt-add-repository -y ppa:teejee2008/ppa
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install conky-manager
|
||||
|
||||
Now launch Applications > Accessories > Conky Manager and select the widget you want to display on your desktop. Conky Manager also allows you to configure it to launch at system startup.
|
||||
|
||||
### 6. Install CompizConfig Settings Manager ###
|
||||
|
||||
If you wish to use Gnome Flashback (Compiz) session then it would be useful to use the compiz settings manager to configure desktop effects. Install it with the following command
|
||||
|
||||
$ sudo apt-get install compizconfig-settings-manager
|
||||
|
||||
Now launch it from System Tools > Preferences > CompizConfig Settings Manager.
|
||||
|
||||
> It so happened inside Virtualbox that, in the compiz session window decorations went missing. To fix it, launch Compiz settings and enable the "Copy to texture" plugin and then logout and login back. It should be fixed.
|
||||
|
||||
However the Compiz session is slower than the Metacity session.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.binarytides.com/install-gnome-flashback-ubuntu/
|
||||
|
||||
作者:[Silver Moon][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://plus.google.com/117145272367995638274/posts
|
||||
[1]:https://wiki.gnome.org/action/show/Projects/GnomeFlashback?action=show&redirect=GnomeFlashback
|
@ -0,0 +1,48 @@
|
||||
Linux FAQs with Answers--How to get the process ID (PID) of a shell script
|
||||
================================================================================
|
||||
> **Question**: I want to know the process ID (PID) of the subshell under which my shell script is running. How can I find a PID in a bash shell script?
|
||||
|
||||
When you execute a shell script, it will launch a process known as a subshell. As a child process of the main shell, a subshell executes a list of commands in a shell script as a batch (so-called "batch processing").
|
||||
|
||||
In some cases, you may want to know the process ID (PID) of the subshell where your shell script is running. This PID information can be used under different circumstances. For example, you can create a unique temporary file in /tmp by naming it with the shell script PID. In case a script needs to examine all running processes, it can exclude its own subshell from the process list.
|
||||
|
||||
In bash, the **PID of a shell script's subshell process** is stored in a special variable called '$$'. This variable is read-only, and you cannot modify it in a shell script. For example:
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
echo "PID of this script: $$"
|
||||
|
||||
The above script will show the following output.
|
||||
|
||||
PID of this script: 6583
|
||||
|
||||
Besides $$, bash shell exports several other read-only variables. For example, PPID stores the process ID of the subshell's parent process (i.e., main shell). UID stores the user ID of the current user who is executing the script. For example:
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
echo "PID of this script: $$"
|
||||
echo "PPID of this script: $PPID"
|
||||
echo "UID of this script: $UID"
|
||||
|
||||
Its output will be:
|
||||
|
||||
PID of this script: 6686
|
||||
PPID of this script: 4656
|
||||
UID of this script: 1000
|
||||
|
||||
In the above, PID will keep changing every time you invoke a script. That is because each invocation of a script will create a new subshell. On the other hand, PPID will remain the same as long as you run a script inside the same shell.
|
||||
|
||||

|
||||
|
||||
For a complete list of built-in bash variables, refer to its man page.
|
||||
|
||||
$ man bash
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/process-id-pid-shell-script.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
469
sources/tech/20150211 25 Tips for Intermediate Git Users.md
Normal file
469
sources/tech/20150211 25 Tips for Intermediate Git Users.md
Normal file
@ -0,0 +1,469 @@
|
||||
25 Tips for Intermediate Git Users
|
||||
================================================================================
|
||||
I’ve been using git for about 18 months now and thought I knew it pretty well. Then we had [Scott Chacon][1] from GitHub over to do some training at [LVS, a supplier/developer of betting/gaming software][2] (where contracted until 2013) and I learnt a ton in the first day.
|
||||
|
||||
As someone who’s always felt fairly comfortable in Git, I thought sharing some of the nuggets I learnt with the community might help someone to find an answer without needing to do lots of research.
|
||||
|
||||
### Basic Tips ###
|
||||
|
||||
#### 1. First Steps After Install ####
|
||||
|
||||
After installing Git, the first thing you should do is configure your name and email, as every commit will have these details:
|
||||
|
||||
$ git config --global user.name "Some One"
|
||||
$ git config --global user.email "someone@gmail.com"
|
||||
|
||||
#### 2. Git is Pointer-Based ####
|
||||
|
||||
Everything stored in git is in a file. When you create a commit it creates a file containing your commit message and associated data (name, email, date/time, previous commit, etc) and links it to a tree file. The tree file contains a list of objects or other trees. The object or blob is the actual content associated with the commit (a file, if you will, although the filename isn’t stored in the object, but in the tree). All of these files are stored with a filename of a SHA-1 hash of the object.
|
||||
|
||||
From there branches and tags are simply files containing (basically) a SHA-1 hash which points to the commit. Using these references allows for a lot of flexibility and speed, as creating a new branch is as simple as creating a file with the name of the branch and the SHA-1 reference to the commit you’re branching from. Of course, you’d never do that as you’d use the Git command line tools (or a GUI), but it’s that simple.
|
||||
|
||||
You may have heard references to the HEAD. This is simply a file containing the SHA-1 reference of the commit you’re currently pointing to. If you’re resolving a merge conflict and see HEAD, that’s nothing to do with a particular branch or necessarily a particular point on the branch but where you currently are.
|
||||
|
||||
All the branch pointers are kept in .git/refs/heads, HEAD is in .git/HEAD and tags are in .git/refs/tags – feel free to have a look in there.
|
||||
|
||||
#### 3. Two Parents – of course! ####
|
||||
|
||||
When viewing a merge commit message in a log, you will see two parents (as opposed to the normal one for a work-based commit). The first parent is the branch you were on and the second is the one you merged in to it.
|
||||
|
||||
#### 4. Merge Conflicts ####
|
||||
|
||||
By now I’m sure you have had a merge conflict and had to resolve it. This is normally done by editing the file, removing the <<<<, ====, >>>> markers and the keeping the code you want to store. Sometimes it’s nice to see the code before either change, i.e. before you made the change in both branches that now conflicts. This is one command away:
|
||||
|
||||
$ git diff --merge
|
||||
diff --cc dummy.rb
|
||||
index 5175dde,0c65895..4a00477
|
||||
--- a/dummy.rb
|
||||
+++ b/dummy.rb
|
||||
@@@ -1,5 -1,5 +1,5 @@@
|
||||
class MyFoo
|
||||
def say
|
||||
- puts "Bonjour"
|
||||
- puts "Hello world"
|
||||
++ puts "Annyong Haseyo"
|
||||
end
|
||||
end
|
||||
|
||||
If the file is binary, diffing files isn’t so easy… What you’ll normally want to do is to try each version of the binary file and decide which one to use (or manually copy portions over in the binary file’s editor). To pull a copy of the file from a particular branch (say you’re merging master and feature132):
|
||||
|
||||
$ git checkout master flash/foo.fla # or...
|
||||
$ git checkout feature132 flash/foo.fla
|
||||
$ # Then...
|
||||
$ git add flash/foo.fla
|
||||
|
||||
Another way is to cat the file from git – you can do this to another filename then copy the correct file over (when you’ve decided which it is) to the normal filename:
|
||||
|
||||
$ git show master:flash/foo.fla > master-foo.fla
|
||||
$ git show feature132:flash/foo.fla > feature132-foo.fla
|
||||
$ # Check out master-foo.fla and feature132-foo.fla
|
||||
$ # Let's say we decide that feature132's is correct
|
||||
$ rm flash/foo.fla
|
||||
$ mv feature132-foo.fla flash/foo.fla
|
||||
$ rm master-foo.fla
|
||||
$ git add flash/foo.fla
|
||||
|
||||
UPDATE: Thanks to Carl in the comments on the original blog post for the reminder, you can actually use “git checkout —ours flash/foo.fla” and “git checkout —theirs flash/foo.fla” to checkout a particular version without remembering which branches you merge in. Personally I prefer to be more explicit, but the option is there…
|
||||
|
||||
Remember to add the file after resolving the merge conflict (as I do above).
|
||||
|
||||
### Servers, Branching and Tagging ###
|
||||
|
||||
#### 5. Remote Servers ####
|
||||
|
||||
One of the most powerful features of Git is the ability to have more than one remote server (as well as the fact that you’re running a local repository always). You don’t always need write access either, you may have multiple servers you read from (to merge work in) and then write to another. To add a new remote server is simple:
|
||||
|
||||
$ git remote add john git@github.com:johnsomeone/someproject.git
|
||||
|
||||
If you want to see information about your remote servers you can do:
|
||||
|
||||
# shows URLs of each remote server
|
||||
$ git remote -v
|
||||
|
||||
# gives more details about each
|
||||
$ git remote show name
|
||||
|
||||
You can always see the differences between a local branch and a remote branch:
|
||||
|
||||
$ git diff master..john/master
|
||||
|
||||
You can also see the changes on HEAD that aren’t on that remote branch:
|
||||
|
||||
$ git log remote/branch..
|
||||
# Note: no final refspec after ..
|
||||
|
||||
#### 6. Tagging ####
|
||||
|
||||
In Git there are two types of tag – a lightweight tag and an annotated tag. Bearing in mind Tip 2 about Git being pointer based, the difference between the two is simple. A lightweight tag is simply a named pointer to a commit. You can always change it to point to another commit. An annotated tag is a name pointer to a tag object, with it’s own message and history. As it has it’s own message it can be GPG signed if required.
|
||||
|
||||
Creating the two types of tag is easy (and one command line switch different)
|
||||
|
||||
$ git tag to-be-tested
|
||||
$ git tag -a v1.1.0 # Prompts for a tag message
|
||||
|
||||
#### 7. Creating Branches ####
|
||||
|
||||
Creating branches in git is very easy (and lightning quick due to it only needing to create a less than 100 byte file). The longhand way of creating a new branch and switching to it:
|
||||
|
||||
$ git branch feature132
|
||||
$ git checkout feature132
|
||||
|
||||
Of course, if you know you’re going to want to switch to it straight away you can do it in one command:
|
||||
|
||||
$ git checkout -b feature132
|
||||
|
||||
If you want to rename a local branch it’s as easy as (the long way to show what happens):
|
||||
|
||||
$ git checkout -b twitter-experiment feature132
|
||||
$ git branch -d feature132
|
||||
|
||||
Update: Or you can (as Brian Palmer points out in the comments on the original blog post) just use the -m switch to “git branch” to do it in one step (as Mike points out, if you only specify one branch it renames your current branch):
|
||||
|
||||
$ git branch -m twitter-experiment
|
||||
$ git branch -m feature132 twitter-experiment
|
||||
|
||||
#### 8. Merging Branches ####
|
||||
|
||||
At some point in the future, you’re going to want to merge your changes back in. There are two ways to do this:
|
||||
|
||||
$ git checkout master
|
||||
$ git merge feature83 # Or...
|
||||
$ git rebase feature83
|
||||
|
||||
The difference between merge and rebase is that merge tries to resolve the changes and create a new commit that blends them. Rebase tries to take your changes since you last diverged from the other branch and replay them from the HEAD of the other branch. However, don’t rebase after you’ve pushed a branch to a remote server – this can cause confusion/problems.
|
||||
|
||||
If you aren’t sure which branches still have unique work on them – so you know which you need to merge and which ones can be removed, there are two switches to git branch that help:
|
||||
|
||||
# Shows branches that are all merged in to your current branch
|
||||
$ git branch --merged
|
||||
|
||||
# Shows branches that are not merged in to your current branch
|
||||
$ git branch --no-merged
|
||||
|
||||
#### 9. Remote Branches ####
|
||||
|
||||
If you have a local branch that you’d like to appear on a remote server, you can push it up with one command:
|
||||
|
||||
$ git push origin twitter-experiment:refs/heads/twitter-experiment
|
||||
# Where origin is our server name and twitter-experiment is the branch
|
||||
|
||||
Update: Thanks to Erlend in the comments on the original blog post – this is actually the same as doing `git push origin twitter-experiment` but by using the full syntax you can see that you can actually use different names on both ends (so your local can be `add-ssl-support` while your remote name can be `issue-1723`).
|
||||
|
||||
If you want to delete a branch from the server (note the colon before the branch name):
|
||||
|
||||
$ git push origin :twitter-experiment
|
||||
|
||||
If you want to show the state of all remote branches you can view them like this:
|
||||
|
||||
$ git remote show origin
|
||||
|
||||
This may list some branches that used to exist on the server but now don’t exist. If this is the case you can easily remove them from your local checkout using:
|
||||
|
||||
$ git remote prune
|
||||
|
||||
Finally, if you have a remote branch that you want to track locally, the longhand way is:
|
||||
|
||||
$ git branch --track myfeature origin/myfeature
|
||||
$ git checkout myfeature
|
||||
|
||||
However, newer versions of Git automatically set up tracking if you use the -b flag to checkout:
|
||||
|
||||
$ git checkout -b myfeature origin/myfeature
|
||||
|
||||
### Storing Content in Stashes, Index and File System ###
|
||||
|
||||
#### 10. Stashing ####
|
||||
|
||||
In Git you can drop your current work state in to a temporary storage area stack and then re-apply it later. The simple case is as follows:
|
||||
|
||||
$ git stash
|
||||
# Do something...
|
||||
$ git stash pop
|
||||
|
||||
A lot of people recommend using `git stash apply` instead of pop, however if you do this you end up with a long list of stashes left hanging around. “pop” will only remove it from the stack if it applies cleanly. If you’ve used `git stash apply` you can remove the last item from the stack anyway using:
|
||||
|
||||
$ git stash drop
|
||||
|
||||
Git will automatically create a comment based on the current commit message. If you’d prefer to use a custom message (as it may have nothing to do with the previous commit):
|
||||
|
||||
$ git stash save "My stash message"
|
||||
|
||||
If you want to apply a particular stash from your list (not necessarily the last one) you can list them and apply it like this:
|
||||
|
||||
$ git stash list
|
||||
stash@{0}: On master: Changed to German
|
||||
stash@{1}: On master: Language is now Italian
|
||||
$ git stash apply stash@{1}
|
||||
|
||||
#### 11. Adding Interactively ####
|
||||
|
||||
In the subversion world you change files and then just commit everything that has changed. In Git you have a LOT more power to commit just certain files or even certain patches. To commit certain files or parts of files you need to go in to interactive mode.
|
||||
|
||||
$ git add -i
|
||||
staged unstaged path
|
||||
|
||||
|
||||
*** Commands ***
|
||||
1: status 2: update 3: revert 4: add untracked
|
||||
5: patch 6: diff 7: quit 8: help
|
||||
What now>
|
||||
|
||||
This drops you in to a menu based interactive prompt. You can use the numbers of the commands or the highlighted letters (if you have colour highlighting turned on) to go in to that mode. Then it’s normally a matter of typing the numbers of the files you want to apply that action to (you can use formats like 1 or 1-4 or 2,4,7).
|
||||
|
||||
If you want to go to patch mode (‘p’ or ‘5’ from interactive mode) you can also go straight in to that mode:
|
||||
|
||||
$ git add -p
|
||||
diff --git a/dummy.rb b/dummy.rb
|
||||
index 4a00477..f856fb0 100644
|
||||
--- a/dummy.rb
|
||||
+++ b/dummy.rb
|
||||
@@ -1,5 +1,5 @@
|
||||
class MyFoo
|
||||
def say
|
||||
- puts "Annyong Haseyo"
|
||||
+ puts "Guten Tag"
|
||||
end
|
||||
end
|
||||
Stage this hunk [y,n,q,a,d,/,e,?]?
|
||||
|
||||
As you can see you then get a set of options at the bottom for choosing to add this changed part of the file, all changes from this file, etc. Using the ‘?’ command will explain the options.
|
||||
|
||||
#### 12. Storing/Retrieving from the File System ####
|
||||
|
||||
Some projects (the Git project itself for example) store additional files directly in the Git file system without them necessarily being a checked in file.
|
||||
|
||||
Let’s start off by storing a random file in Git:
|
||||
|
||||
$ echo "Foo" | git hash-object -w --stdin
|
||||
51fc03a9bb365fae74fd2bf66517b30bf48020cb
|
||||
|
||||
At this point the object is in the database, but if you don’t set something up to point to that object it will be garbage collected. The easiest way is to tag it:
|
||||
|
||||
$ git tag myfile 51fc03a9bb365fae74fd2bf66517b30bf48020cb
|
||||
|
||||
Note that here we’ve used the tag myfile. When we need to retrieve the file we can do it with:
|
||||
|
||||
$ git cat-file blob myfile
|
||||
|
||||
This can be useful for utility files that developers may need (passwords, gpg keys, etc) but you don’t want to actually check out on to disk every time (particularly in production).
|
||||
|
||||
### Logging and What Changed? ###
|
||||
|
||||
#### 13. Viewing a Log ####
|
||||
|
||||
You can’t use Git for long without using ‘git log’ to view your recent commits. However, there are some tips on how to use it better. For example, you can view a patch of what changed in each commit with:
|
||||
|
||||
$ git log -p
|
||||
|
||||
Or you can just view a summary of which files changed with:
|
||||
|
||||
$ git log --stat
|
||||
|
||||
There’s a nice alias you can set up which shows abbreviated commits and a nice graph of branches with the messages on a single line (like gitk, but on the command line):
|
||||
|
||||
$ git config --global alias.lol "log --pretty=oneline --abbrev-commit --graph --decorate"
|
||||
$ git lol
|
||||
* 4d2409a (master) Oops, meant that to be in Korean
|
||||
* 169b845 Hello world
|
||||
|
||||
#### 14. Searching in the Log ####
|
||||
|
||||
If you want to search for a particular author you can specify that:
|
||||
|
||||
$ git log --author=Andy
|
||||
|
||||
Update: Thanks to Johannes in the comments, I’ve cleared up some of the confusion here.
|
||||
|
||||
Or if you have a search term that appears in the commit message:
|
||||
|
||||
$ git log --grep="Something in the message"
|
||||
|
||||
There’s also a more powerful command called the pickaxe command that look for the entry that removes or adds a particular piece of content (i.e. when it first appeared or was removed). This can tell you when a line was added (but not if a character on that line was later changed):
|
||||
|
||||
$ git log -S "TODO: Check for admin status"
|
||||
|
||||
What about if you changed a particular file, e.g. `lib/foo.rb`
|
||||
|
||||
$ git log lib/foo.rb
|
||||
|
||||
Let’s say you have a `feature/132` branch and a `feature/145` and you want to view the commits on those branches that aren’t on master (note the ^ meaning not):
|
||||
|
||||
$ git log feature/132 feature/145 ^master
|
||||
|
||||
You can also narrow it down to a date range using ActiveSupport style dates:
|
||||
|
||||
$ git log --since=2.months.ago --until=1.day.ago
|
||||
|
||||
By default it will use OR to combine the query, but you can easily change it to use AND (if you have more than one criteria)
|
||||
|
||||
$ git log --since=2.months.ago --until=1.day.ago --author=andy -S "something" --all-match
|
||||
|
||||
#### 15. Selecting Revisions to View/Change ####
|
||||
|
||||
There are a number of items you can specify when referring to a revision, depending on what you know about it:
|
||||
|
||||
$ git show 12a86bc38 # By revision
|
||||
$ git show v1.0.1 # By tag
|
||||
$ git show feature132 # By branch name
|
||||
$ git show 12a86bc38^ # Parent of a commit
|
||||
$ git show 12a86bc38~2 # Grandparent of a commit
|
||||
$ git show feature132@{yesterday} # Time relative
|
||||
$ git show feature132@{2.hours.ago} # Time relative
|
||||
|
||||
Note that unlike the previous section, a caret on the end means the parent of that commit – a caret at the start means not on this branch.
|
||||
|
||||
#### 16. Selecting a Range ####
|
||||
|
||||
The easiest way is to use:
|
||||
|
||||
$ git log origin/master..new
|
||||
# [old]..[new] - everything you haven't pushed yet
|
||||
|
||||
You can also omit the [new] and it will use your current HEAD.
|
||||
|
||||
### Rewinding Time & Fixing Mistakes ###
|
||||
|
||||
#### 17. Resetting changes ####
|
||||
|
||||
You can easily unstage a change if you haven’t committed it using:
|
||||
|
||||
$ git reset HEAD lib/foo.rb
|
||||
|
||||
Often this is aliased to ‘unstage’ as it’s a bit non-obvious.
|
||||
|
||||
$ git config --global alias.unstage "reset HEAD"
|
||||
$ git unstage lib/foo.rb
|
||||
|
||||
If you’ve committed the file already, you can do two things – if it’s the last commit you can just amend it:
|
||||
|
||||
$ git commit --amend
|
||||
|
||||
This undoes the last commit, puts your working copy back as it was with the changes staged and the commit message ready to edit/commit next time you commit.
|
||||
|
||||
If you’ve committed more than once and just want to completely undo them, you can reset the branch back to a previous point in time.
|
||||
|
||||
$ git checkout feature132
|
||||
$ git reset --hard HEAD~2
|
||||
|
||||
If you actually want to bring a branch to point to a completely different SHA1 (maybe you’re bringing the HEAD of a branch to another branch, or a further commit) you can do the following to do it the long way:
|
||||
|
||||
$ git checkout FOO
|
||||
$ git reset --hard SHA
|
||||
|
||||
There’s actually a quicker way (as it doesn’t change your working copy back to the state of FOO first then forward to SHA):
|
||||
|
||||
$ git update-ref refs/heads/FOO SHA
|
||||
|
||||
#### 18. Committing to the Wrong Branch ####
|
||||
|
||||
OK, let’s assume you committed to master but should have created a topic branch called experimental instead. To move those changes over, you can create a branch at your current point, rewind head and then checkout your new branch:
|
||||
|
||||
$ git branch experimental # Creates a pointer to the current master state
|
||||
$ git reset --hard master~3 # Moves the master branch pointer back to 3 revisions ago
|
||||
$ git checkout experimental
|
||||
|
||||
This can be more complex if you’ve made the changes on a branch of a branch of a branch etc. Then what you need to do is rebase the change on a branch on to somewhere else:
|
||||
|
||||
$ git branch newtopic STARTPOINT
|
||||
$ git rebase oldtopic --onto newtopic
|
||||
|
||||
#### 19. Interactive Rebasing ####
|
||||
|
||||
This is a cool feature I’ve seen demoed before but never actually understood, now it’s easy. Let’s say you’ve made 3 commits but you want to re-order them or edit them (or combine them):
|
||||
|
||||
$ git rebase -i master~3
|
||||
|
||||
Then you get your editor pop open with some instructions. All you have to do is amend the instructions to pick/squash/edit (or remove them) commits and save/exit. Then after editing you can `git rebase —continue` to keep stepping through each of your instructions.
|
||||
|
||||
If you choose to edit one, it will leave you in the state you were in at the time you committed that, so you need to use git commit —amend to edit it.
|
||||
|
||||
**Note: DO NOT COMMIT DURING REBASE – only add then use —continue, —skip or —abort.**
|
||||
|
||||
#### 20. Cleaning Up ####
|
||||
|
||||
If you’ve committed some content to your branch (maybe you’ve imported an old repo from SVN) and you want to remove all occurrences of a file from the history:
|
||||
|
||||
$ git filter-branch --tree-filter 'rm -f *.class' HEAD
|
||||
|
||||
If you’ve already pushed to origin, but have committed the rubbish since then, you can also do this for your local system before pushing:
|
||||
|
||||
$ git filter-branch --tree-filter 'rm -f *.class' origin/master..HEAD
|
||||
|
||||
### Miscellaneous Tips ###
|
||||
|
||||
#### 21. Previous References You’ve Viewed ####
|
||||
|
||||
If you know you’ve previously viewed a SHA-1, but you’ve done some resetting/rewinding you can use the reflog commands to view the SHA-1s you’ve recently viewed:
|
||||
|
||||
$ git reflog
|
||||
$ git log -g # Same as above, but shows in 'log' format
|
||||
|
||||
#### 22. Branch Naming ####
|
||||
|
||||
A lovely little tip – don’t forget that branch names aren’t limited to a-z and 0-9. It can be quite nice to use / and . in names for fake namespacing or versionin, for example:
|
||||
|
||||
$ # Generate a changelog of Release 132
|
||||
$ git shortlog release/132 ^release/131
|
||||
$ # Tag this as v1.0.1
|
||||
$ git tag v1.0.1 release/132
|
||||
|
||||
#### 23. Finding Who Dunnit ####
|
||||
|
||||
Often it can be useful to find out who changed a line of code in a file. The simple command to do this is:
|
||||
|
||||
$ git blame FILE
|
||||
|
||||
Sometimes the change has come from a previous file (if you’ve combined two files, or you’ve moved a function) so you can use:
|
||||
|
||||
$ # shows which file names the content came from
|
||||
$ git blame -C FILE
|
||||
|
||||
Sometimes it’s nice to track this down by clicking through changes and going further and further back. There’s a nice in-built gui for this:
|
||||
|
||||
$ git gui blame FILE
|
||||
|
||||
#### 24. Database Maintenance ####
|
||||
|
||||
Git doesn’t generally require a lot of maintenance, it pretty much takes care of itself. However, you can view the statistics of your database using:
|
||||
|
||||
$ git count-objects -v
|
||||
|
||||
If this is high you can choose to garbage collect your clone. This won’t affect pushes or other people but it can make some of your commands run much faster and take less space:
|
||||
|
||||
$ git gc
|
||||
|
||||
It also might be worth running a consistency check every so often:
|
||||
|
||||
$ git fsck --full
|
||||
|
||||
You can also add a `—auto` parameter on the end (if you’re running it frequently/daily from crontab on your server) and it will only fsck if the stats show it’s necessary.
|
||||
|
||||
When checking, getting “dangling” or “unreachable” is fine, this is often a result of rewinding heads or rebasing. Getting “missing” or “sha1 mismatch” is bad… Get professional help!
|
||||
|
||||
#### 25. Recovering a Lost Branch ####
|
||||
|
||||
If you delete a branch experimental with -D you can recreate it with:
|
||||
|
||||
$ git branch experimental SHA1_OF_HASH
|
||||
|
||||
You can often find the SHA1 hash using git reflog if you’ve accessed it recently.
|
||||
|
||||
Another way is to use `git fsck —lost-found`. A dangling commit here is the lost HEAD (it will only be the HEAD of the deleted branch as the HEAD^ is referred to by HEAD so it’s not dangling)
|
||||
|
||||
### Done! ###
|
||||
|
||||
Wow, the longest blog post I’ve ever written, I hope someone finds it useful. If you did, or if you have any questions let me know in the comments…
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.andyjeffries.co.uk/25-tips-for-intermediate-git-users/
|
||||
|
||||
作者:[Andy Jeffries][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.andyjeffries.co.uk/author/andy-jeffries/
|
||||
[1]:http://gitcasts.com/about
|
||||
[2]:http://www.lvs.co.uk/
|
@ -1,158 +0,0 @@
|
||||
+在Linux中使用matplotlib进行科学画图
|
||||
+================================================================================
|
||||
+
|
||||
+如果你想要在Linxu中获得一个高效、自动化、高质量的科学画图的解决方案,那就要考虑一下使用matplotlib库了。Matplotlib是基于python的开源科学测绘包,版权基于python软件基金许可证。大量的文档和例子,整合在Python和Numpy科学计处包中,其自动化性能是少数几个为什么这个包是在Linux环境中进行科学画图的可靠选择。这个教程将提供几个用matplotlib画图的例子。
|
||||
+
|
||||
+###特性###
|
||||
+-
|
||||
+-众多的画图类型,如:bar,box,contour,histogram,scatter,line plots....
|
||||
+-基于python的语法
|
||||
+-集成Numpy科学计算包
|
||||
+-可定制的画图格式(axes scales,tick positions, tick labels...)
|
||||
+-可定制文本(字体,大小,位置...)
|
||||
+-TeX 格式化(等式,符号,希腊字体...)
|
||||
+-与IPython相兼容
|
||||
+-自动化 -用Python 的循环迭代生成图片
|
||||
+-保存所绘图片格式为图片文件,如:png,pdf,ps,eps,svg等
|
||||
+
|
||||
+
|
||||
+基于Python语法的matplotlib通过许多自身特性和高效工作流基础进行表现。
|
||||
+世面上有许多用于绘制高质量图的科学绘图包,但是这些包允许你直接在你的Python代码中去使用吗?
|
||||
+除那以外,这些包允许你创建可以保存为图片文件的图片吗?
|
||||
+Matplotlib允许你完成所有的这些任务。
|
||||
+你可以期望着节省你的时间,从于使用你能够花更多的时间在如何创建更多的图片。
|
||||
+
|
||||
+###安装###
|
||||
+ 安装Python和Numpy包是使用Matplotlib的前提,安装Numpy的指引请见该链接。[here][1].
|
||||
+
|
||||
+
|
||||
+可以通过如下命令在Debian或Ubuntu中安装Matplotlib:
|
||||
+
|
||||
+ $ sudo apt-get install python-matplotlib
|
||||
+
|
||||
+
|
||||
+在Fedora或CentOS/RHEL环境则可用如下命令:
|
||||
+ $ sudo yum install python-matplotlib
|
||||
+
|
||||
+
|
||||
+###Matplotlib 例子###
|
||||
+
|
||||
+该教程会提供几个绘图例子演示如何使用matplotlib:
|
||||
+-离散和线性画图
|
||||
+-柱状图画图
|
||||
+-饼状图
|
||||
+
|
||||
+在这些例子中我们将用Python脚本来执行Mapplotlib命令。注意numpy和matplotlib模块需要通过import命令在脚本中进行导入。
|
||||
+在命令空间中,np指定为nuupy模块的引用,plt指定为matplotlib.pyplot的引用:
|
||||
+ import numpy as np
|
||||
+ import matplotlib.pyplot as plt
|
||||
+
|
||||
+
|
||||
+###例1:离散和线性图###
|
||||
+
|
||||
+第一个脚本,script1.py 完成如下任务:
|
||||
+
|
||||
+-创建3个数据集(xData,yData1和yData2)
|
||||
+-创建一个宽8英寸、高6英寸的图(赋值1)
|
||||
+-设置图画的标题、x轴标签、y轴标签(字号均为14)
|
||||
+-绘制第一个数据集:yData1为xData数据集的函数,用圆点标识的离散蓝线,标识为"y1 data"
|
||||
+-绘制第二个数据集:yData2为xData数据集的函数,采用红实线,标识为"y2 data"
|
||||
+-把图例放置在图的左上角
|
||||
+-保存图片为PNG格式文件
|
||||
+
|
||||
+script1.py的内容如下:
|
||||
+ import numpy as np
|
||||
+ import matplotlib.pyplot as plt
|
||||
+
|
||||
+ xData = np.arange(0, 10, 1)
|
||||
+ yData1 = xData.__pow__(2.0)
|
||||
+ yData2 = np.arange(15, 61, 5)
|
||||
+ plt.figure(num=1, figsize=(8, 6))
|
||||
+ plt.title('Plot 1', size=14)
|
||||
+ plt.xlabel('x-axis', size=14)
|
||||
+ plt.ylabel('y-axis', size=14)
|
||||
+ plt.plot(xData, yData1, color='b', linestyle='--', marker='o', label='y1 data')
|
||||
+ plt.plot(xData, yData2, color='r', linestyle='-', label='y2 data')
|
||||
+ plt.legend(loc='upper left')
|
||||
+ plt.savefig('images/plot1.png', format='png')
|
||||
+
|
||||
+
|
||||
+所画之图如下:
|
||||
+
|
||||
+
|
||||
+
|
||||
+###例2:柱状图###
|
||||
+
|
||||
+第二个脚本,script2.py 完成如下任务:
|
||||
+
|
||||
+-创建一个包含1000个随机样本的正态分布数据集。
|
||||
+-创建一个宽8英寸、高6英寸的图(赋值1)
|
||||
+-设置图的标题、x轴标签、y轴标签(字号均为14)
|
||||
+-用samples这个数据集画一个40个柱状,边从-10到10的柱状图
|
||||
+-添加文本,用TeX格式显示希腊字母mu和sigma(字号为16)
|
||||
+-保存图片为PNG格式。
|
||||
+
|
||||
+script2.py代码如下:
|
||||
+ import numpy as np
|
||||
+ import matplotlib.pyplot as plt
|
||||
+
|
||||
+ mu = 0.0
|
||||
+ sigma = 2.0
|
||||
+ samples = np.random.normal(loc=mu, scale=sigma, size=1000)
|
||||
+ plt.figure(num=1, figsize=(8, 6))
|
||||
+ plt.title('Plot 2', size=14)
|
||||
+ plt.xlabel('value', size=14)
|
||||
+ plt.ylabel('counts', size=14)
|
||||
+ plt.hist(samples, bins=40, range=(-10, 10))
|
||||
+ plt.text(-9, 100, r'$\mu$ = 0.0, $\sigma$ = 2.0', size=16)
|
||||
+ plt.savefig('images/plot2.png', format='png')
|
||||
+
|
||||
+
|
||||
+结果见如下链接:
|
||||
+
|
||||
+
|
||||
+
|
||||
+###例3:饼状图###
|
||||
+
|
||||
+第三个脚本,script3.py 完成如下任务:
|
||||
+
|
||||
+-创建一个包含5个整数的列表
|
||||
+-创建一个宽6英寸、高6英寸的图(赋值1)
|
||||
+-添加一个长宽比为1的轴图
|
||||
+-设置图的标题(字号为14)
|
||||
+-用data列表画一个包含标签的饼状图
|
||||
+-保存图为PNG格式
|
||||
+
|
||||
+脚本script3.py的代码如下:
|
||||
+ import numpy as np
|
||||
+ import matplotlib.pyplot as plt
|
||||
+
|
||||
+ data = [33, 25, 20, 12, 10]
|
||||
+ plt.figure(num=1, figsize=(6, 6))
|
||||
+ plt.axes(aspect=1)
|
||||
+ plt.title('Plot 3', size=14)
|
||||
+ plt.pie(data, labels=('Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5'))
|
||||
+ plt.savefig('images/plot3.png', format='png')
|
||||
+
|
||||
+
|
||||
+结果如下链接所示:
|
||||
+
|
||||
+
|
||||
+
|
||||
+###总结###
|
||||
+ 这个教程提供了几个用matplotlib科学画图包进行画图的例子,Matplotlib是在Linux环境中用于解决科学画图的绝佳方案,表现在其无缝地和Python、Numpy连接,自动化能力,和提供多种自定义的高质量的画图产品。[here][2].
|
||||
+
|
||||
+matplotlib包的文档和例子详见:
|
||||
+--------------------------------------------------------------------------------
|
||||
+
|
||||
+via: http://xmodulo.com/matplotlib-scientific-plotting-linux.html
|
||||
+
|
||||
+作者:[Joshua Reed][a]
|
||||
+译者:[ideas4u](https://github.com/ideas4u)
|
||||
+校对:[校对者ID](https://github.com/校对者ID)
|
||||
+
|
||||
+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
+
|
||||
+[a]:http://xmodulo.com/author/joshua
|
||||
+[1]:http://xmodulo.com/numpy-scientific-computing-linux.html
|
||||
+[2]:http://matplotlib.org/
|
@ -0,0 +1,146 @@
|
||||
如何在 Ubuntu 14.04 里面配置 chroot 环境
|
||||
================================================================================
|
||||
你可能会有很多理由想要把一个应用、一个用户或者一个环境与你的 linux 系统隔离开来。不同的操作系统有不同的实现方式,而在 linux 中,一个典型的方式就是 chroot 环境。
|
||||
|
||||
在这份教程中,我会一步一步指导你怎么使用 chroot 命令去配置一个与真实系统分离出来的独立环境。这个功能主要可以用于测试项目,这些步骤都在 **Ubuntu 14.04** 虚拟专用服务器(VPS)上执行。
|
||||
|
||||
学会快速搭建一个简单的 chroot 环境是一项非常实用的技能,绝大多数系统管理员都能从中受益。
|
||||
|
||||
### Chroot 环境 ###
|
||||
|
||||
一个 chroot 环境就是通过系统调用,将一个本地目录临时变成根目录。一般所说的系统根目录就是挂载点"/",然而使用 chroot 命令后,你可以使用其它目录作为根目录。
|
||||
|
||||
原则上,任何运行在 chroot 环境内的应用都不能访问系统中其他信息(LCTT译注:使用 chroot 把一个目录变成根目录,在里面运行的应用只能访问本目录内的文件,无法访问到目录外的文件。然而,运行在 chroot 环境的应用可以通过 sysfs 文件系统访问到环境外的信息,所以,这里有个“原则上”的修饰语)。
|
||||
|
||||
### Chroot 环境的用处 ###
|
||||
|
||||
> - 测试一个不稳定的应用服务不会影响到整个主机系统。
|
||||
>
|
||||
> - 就算使用 root 权限做了些不当的操作,把 chroot 环境搞得一塌糊涂,也不会影响到主机系统。
|
||||
>
|
||||
> - 可以在你的系统中运行另外一个操作系统。
|
||||
|
||||
举个例子,你可以在 chroot 环境中编译、安装、测试软件,而不去动真实的系统。你也可以**在64位环境下使用 chroot 创建一个32位环境,然后运行一个32位的程序**(LCTT泽注:如果你的真实环境是32位的,那就不能 chroot 一个64位的环境了)。
|
||||
|
||||
但是 为了安全考虑,chroot 环境为非特权用户设立了非常严格的限制,而不是提供完整的安全策略。如果你需要的是有完善的安全策略的隔离方案,可以考虑下 LXC、Docker、vservers等等。
|
||||
|
||||
### Debootstrap 和 Schroot ###
|
||||
|
||||
使用 chroot 环境需要安装 **debootstrap** 和 **schroot**,这两个软件都在 Ubuntu 的镜像源中。其中 schroot 用于创建 chroot 环境。
|
||||
|
||||
**Debootstrap** 可以让你通过镜像源安装任何 Debian(或基于 Debian 的)系统,装好的系统会包含最基本的命令。
|
||||
|
||||
**Schroot** 命令允许用户使用相同的机制去创建 chroot 环境,但在访问 chroot 环境时会做些权限检查,并且会允许用户做些额外的自动设置,比如挂载一些文件系统。
|
||||
|
||||
在 Ubuntu 14.04 LTS 上,我们可以通过两步来实现这个功能:
|
||||
|
||||
### 1. 安装软件包 ###
|
||||
|
||||
第一步,在Ubuntu 14.04 LTS 主机系统上安装 debootstrap 和 schroot:
|
||||
|
||||
$ sudo apt-get install debootstrap
|
||||
$ sudo apt-get install schroot
|
||||
|
||||
### 2. 配置 Schroot ###
|
||||
|
||||
现在我们有工具在手,需要指定一个目录作为我们的 chroot 环境。这里创建一个目录先:
|
||||
|
||||
sudo mkdir /linoxide
|
||||
|
||||
编辑 schroot 的配置文件:
|
||||
|
||||
sudo nano /etc/schroot/schroot.conf
|
||||
|
||||
再提醒一下,我们现在是在 Ubuntu 14.04 LTS 系统上。如果我们想测试一个软件包能不能在 Ubuntu 13.10(代号是“Saucy Salamander”) 上运行,就可以在配置文件中添加下面的内容:
|
||||
|
||||
[saucy]
|
||||
description=Ubuntu Saucy
|
||||
location=/linoxide
|
||||
priority=3
|
||||
users=arun
|
||||
root-groups=root
|
||||
|
||||

|
||||
|
||||
根据你的系统要求,调整上面的配置信息。
|
||||
|
||||
### 3. 使用 debootstrap 安装32位 Ubuntu 系统 ###
|
||||
|
||||
Debootstrap 命令会在你的 **chroot 环境**里面下载安装一个最小系统。只要你能访问镜像源,你就可以安装任何基于 Debian 的系统版本。
|
||||
|
||||
前面我们已经创建了 **/linoxide** 目录用于放置 chroot 环境,现在我们可以在这个目录里面运行 debootstrap 了:
|
||||
|
||||
cd /linoxide
|
||||
sudo debootstrap --variant=buildd --arch amd64 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/
|
||||
sudo chroot /linoxide /debootstrap/debootstrap --second-stage
|
||||
|
||||
你可以将 --arch 的参数换成 i386 或其他架构,只要存在这种架构的镜像源。你也可以把镜像源 http://archive.ubuntu.com/ubuntu/ 换成离你最近的镜像源,具体可参考 [Ubuntu 官方镜像主页][1]。
|
||||
|
||||
**注意:如果你是在64位系统中创建32位系统,你需要在上面第3行命令中加入 --foreign 选项,就像下面的命令:**
|
||||
|
||||
sudo debootstrap --variant=buildd --foreign --arch i386 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/
|
||||
|
||||
下载需要一段时间,看你网络带宽性能。最小系统大概有500M。
|
||||
|
||||
### 4. 完成 chroot 环境 ###
|
||||
|
||||
安装完系统后,我们需要做一些收尾工作,确保系统运行正常。首先,保证主机的 fstab 程序能意识到 chroot 环境的存在:
|
||||
|
||||
sudo nano /etc/fstab
|
||||
|
||||
在文件最后面添加下面的配置:
|
||||
|
||||
proc /linoxide/proc proc defaults 0 0
|
||||
sysfs /linoxide/sys sysfs defaults 0 0
|
||||
|
||||
保存并关闭文件。
|
||||
|
||||
挂载一些文件系统到 chroot 环境:
|
||||
|
||||
$ sudo mount proc /linoxide/proc -t proc
|
||||
$ sudo mount sysfs /linoxide/sys -t sysfs
|
||||
|
||||
复制 /etc/hosts 文件到 chroot 环境,这样 chroot 环境就可以使用网络了:
|
||||
|
||||
$ sudo cp /etc/hosts /linoxide/etc/hosts
|
||||
|
||||
最后使用 schroot -l 命令列出系统上所有的 chroot 环境:
|
||||
|
||||
$ schroot -l
|
||||
|
||||
使用下面的命令进入 chroot 环境:
|
||||
|
||||
$ sudo chroot /linoxide/ /bin/bash
|
||||
|
||||
测试安装的版本:
|
||||
|
||||
# lsb_release -a
|
||||
# uname -a
|
||||
|
||||
为了在 chroot 环境中使用图形界面,你需要设置 DISPLAY 环境变量:
|
||||
|
||||
$ DISPLAY=:0.0 ./apps
|
||||
|
||||
目前为止,我已经成功地在 Ubuntu 14.04 LTS 上安装了 Ubuntu 13.10。
|
||||
|
||||
退出 chroot 环境:
|
||||
|
||||
# exit
|
||||
|
||||
清理一下,卸载文件系统:
|
||||
|
||||
$ sudo umount /test/proc
|
||||
$ sudo umount /test/sys
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/ubuntu-how-to/configure-chroot-environment-ubuntu-14-04/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[bazz2](https://github.com/bazz2)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunp/
|
||||
[1]:https://launchpad.net/ubuntu/+archivemirrors
|
81
translated/tech/20150128 Docker-1 Moving to Docker.md
Normal file
81
translated/tech/20150128 Docker-1 Moving to Docker.md
Normal file
@ -0,0 +1,81 @@
|
||||
Moving to Docker
|
||||
================================================================================
|
||||

|
||||
|
||||
[TL;DR] 这是系列的第一篇文章,这系列讲述了我的公司如何把基础服务从PaaS迁移到Docker上。如果你愿意,你可以直接跳过介绍(这篇文章)直接看技术相关的话题(链接在页面的底部)。
|
||||
|
||||
----------
|
||||
|
||||
上个月,我一直在折腾开发环境。这是我个人故事和经验,关于尝试用Docker简化Rails应用的部署过程。
|
||||
|
||||
当我在2012年创建我的公司 – [Touchware][1]时,我还是一个独立开发者。很多事情很小,不复杂,不他们需要很多维护,他们也不需要不部署到很多机器上。经过过去一年的发展,我们成长了很多(我们现在是是拥有10个人团队)而且我们的服务端的程序和API无论在范围和规模方面都有增长。
|
||||
|
||||
### 第1步 - Heroku ###
|
||||
|
||||
我们还是个小公司,我们需要让事情运行地尽可能平稳。当我们寻找可行的解决方案时,我们打算坚持用那些可以帮助我们减轻对硬件依赖负担的工具。由于我们主要开发Rails应用,而Heroku对RoR,常用的数据库和缓存(Postgres/Mongo/Redis等)有很好的支持,最明智的选择就是用[Heroku][2] 。我们就是这样做的。
|
||||
|
||||
Heroku有很好的技术支持和文档,使得部署非常轻松。唯一的问题是,当你处于起步阶段,你需要很多开销。这不是最好的选择,真的。
|
||||
|
||||
### 第2步 - Dokku ###
|
||||
|
||||
为了尝试并降低成本,我们决定试试Dokku。[Dokku][3],引用GitHub上的一句话
|
||||
|
||||
> Docker powered mini-Heroku in around 100 lines of Bash
|
||||
|
||||
我们启用的[DigitalOcean][4]上的很多台机器,都预装了Dokku。Dokku非常像Heroku,但是当你有复杂的项目需要调整配置参数或者是需要特殊的依赖时,它就不能胜任了。我们有一个应用,它需要对图片进行多次转换,我们无法安装一个适合版本的imagemagick到托管我们Rails应用的基于Dokku的Docker容器内。尽管我们还有很多应用运行在Dokku上,但我们还是不得不把一些迁移回Heroku。
|
||||
|
||||
### 第3步 - Docker ###
|
||||
|
||||
几个月前,由于开发环境和生产环境的问题重新出现,我决定试试Docker。简单来说,Docker让开发者容器化应用,简化部署。由于一个Docker容器本质上已经包含项目运行所需要的所有依赖,只要它能在你的笔记本上运行地很好,你就能确保它将也能在任何一个别的远程服务器的生产环境上运行,包括Amazon的EC2和DigitalOcean上的VPS。
|
||||
|
||||
Docker IMHO特别有意思的原因是:
|
||||
|
||||
- 它促进了模块化和分离关注点:你只需要去考虑应用的逻辑部分(负载均衡:1个容器;数据库:1个容器;web服务器:1个容器);
|
||||
- 在部署的配置上非常灵活:容器可以被部署在大量的HW上,也可以容易地重新部署在不同的服务器或者提供商那;
|
||||
- 它允许非常细粒度地优化应用的运行环境:你可以利用你的容器来创建镜像,所以你有很多选择来配置环境。
|
||||
|
||||
它也有一些缺点:
|
||||
|
||||
- 它的学习曲线非常的陡峭(这是从一个软件开发者的角度来看,而不是经验丰富的运维人员);
|
||||
- 搭建环境不简单,尤其是还需要自己搭建一个私有的registry/repository (后面有关于它的详细内容)。
|
||||
|
||||
下面是一些提示。这个系列的最后一周,我将把他们和一些新的放在一起。
|
||||
|
||||
----------
|
||||
|
||||
在下面的文章中,我们将看到如何建立一个半自动化的基于Docker的部署系统。
|
||||
|
||||
- [建立私有的Docker registry][6]
|
||||
- [配置Rails应用的半自动化话部署][7]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://cocoahunter.com/2015/01/23/docker-1/
|
||||
|
||||
作者:[Michelangelo Chasseur][a]
|
||||
译者:[mtunique](https://github.com/mtunique)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://cocoahunter.com/author/michelangelo/
|
||||
[1]:http://www.touchwa.re/
|
||||
[2]:http://cocoahunter.com/2015/01/23/docker-1/www.heroku.com
|
||||
[3]:https://github.com/progrium/dokku
|
||||
[4]:http://cocoahunter.com/2015/01/23/docker-1/www.digitalocean.com
|
||||
[5]:http://www.docker.com/
|
||||
[6]:http://cocoahunter.com/2015/01/23/docker-2/
|
||||
[7]:http://cocoahunter.com/2015/01/23/docker-3/
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
||||
[13]:
|
||||
[14]:
|
||||
[15]:
|
||||
[16]:
|
||||
[17]:
|
||||
[18]:
|
||||
[19]:
|
||||
[20]:
|
@ -0,0 +1,37 @@
|
||||
在Ubuntu 14.04 中修复无法修复回收站[快速提示]
|
||||
================================================================================
|
||||

|
||||
|
||||
### 问题 ###
|
||||
|
||||
**无法在Ubuntu 14.04中清空回收站的问题**。我右键回收站图标并选择清空回收站,就像我一直做的那样。我看到进度条显示删除文件中过了一段时间。但是它停止了,并且Nautilus文件管理也停止了。我不得不在终端中停止了它。
|
||||
|
||||
但是这很痛苦因为文件还在垃圾箱中。并且我反复尝试清空后窗口都冻结了。
|
||||
|
||||
### 方案 ###
|
||||
|
||||
老实说,我不知道什么导致了这个问题。但是我有一个解决方案如果你在Ubuntu 14.04或者14.10遇到这个问题的话。
|
||||
|
||||
打开终端并使用下面的命令:
|
||||
|
||||
sudo rm -rf ~/.local/share/Trash/*
|
||||
|
||||
这里注意你的输入。你使用超级管理员权限来运行删除命令。我相信你不会删除其他文件或者目录。
|
||||
|
||||
上面的命令会删除回收站目录下的所有文件。换句话说,这是用命令清空垃圾箱。使用玩上面的命令后,你会看到垃圾箱已经清空了。如果你删除了所有文件,你不应该在看到Nautilus崩溃的问题了。
|
||||
|
||||
### 对你有用么? ###
|
||||
|
||||
我希望这篇贴士对你有用,今后你也不会在Ubuntu或者其他发行版中再遇到相同的问题。如果你遇到任何问题请让我知道。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/fix-empty-trash-ubuntu/
|
||||
|
||||
作者:[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/
|
@ -0,0 +1,91 @@
|
||||
Linux 有问必答:如何在Linux 中修复“fatal error: x264.h: No such file or directory”的错误
|
||||
================================================================================
|
||||
> **提问**: 我想在Linux中从源码编译视频编码程序。到那时,在编译时,我遇到了一个错误“fatal error: x264.h: No such file or directory”,我该如何修复?
|
||||
|
||||
下面的编译错误错明你系统中没有x264开发库文件。
|
||||
|
||||
fatal error: x264.h: No such file or directory
|
||||
|
||||
[x264][1]是GNU GPL授权的H.264/MPEG-4 AVC编码库。x264库被广泛用于视频编码/转码程序比如Avidemux、[FFmpeg][2]、 [HandBrake][3]、 OpenShot、 MEncode等等。
|
||||
|
||||
要解决这个问题,你需要安装x264的开发库文件。你可以这么做。
|
||||
|
||||
###在 Debian、 Ubuntu 或者 Linux Mint 中安装像x264库和开发文件 ###
|
||||
|
||||
在基于Debian的系统中,x264库已经包含在基础仓库中。可以直接用apt-get来安装。
|
||||
|
||||
$ sudo apt-get install libx264-dev
|
||||
|
||||
### 在 Fedora、 CentOS/RHEL中安装像x264库和开发文件 ###
|
||||
|
||||
在基于Red Hat的发行版比如Fedora或者CentOS,x264库在免费的RPM Fusion仓库中有。那么,你需要首先安装[RPM Fusion (免费)][4] 。
|
||||
|
||||
RPM Fusion设置完成后,你可以使用下面的命令安装x264开发文件。
|
||||
|
||||
$ sudo yum --enablerepo=rpmfusion-free install x264-devel
|
||||
|
||||
注意RPM Fusion仓库在CentOS 7中还没有,因此上面的方法在CentOS 7中还不可行。万一是CentOS 7 ,你可以从源码编译并安装x264,下面会解释的。
|
||||
|
||||
### 在Debian、 Ubuntu 或者 Linux Mint中源码编译x264库 ###
|
||||
|
||||
如果libx264包在你的发行版中并没有,那么你可以按照下面的方法编译最新的x264库。
|
||||
|
||||
$ sudo apt-get install g++ automake autoconf libtool yasm nasm git
|
||||
$ git clone git://git.videolan.org/x264.git
|
||||
$ cd x264
|
||||
$ ./configure --enable-static --enable-shared
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
x264库将会安装在/usr/local/lib。要让其他程序可以使用这个库,你需要完成最后一步。
|
||||
|
||||
打开/etc/ld.so.conf,并添加下面的行。
|
||||
|
||||
$ sudo vi /etc/ld.so.conf
|
||||
|
||||
----------
|
||||
|
||||
/usr/local/lib
|
||||
|
||||
最后运行下面的命令重新加载共享库:
|
||||
|
||||
$ sudo ldconfig
|
||||
|
||||
### 在 Fedora, CentOS/RHEL 中源码编译x264库 ###
|
||||
|
||||
如果你Linux的发行版中没有x264库(比如:CentOS 7)或者x264库并不是最新的,你可以如下编译最新的x264库。
|
||||
|
||||
$ sudo yum install gcc gcc-c++ automake autoconf libtool yasm nasm git
|
||||
$ git clone git://git.videolan.org/x264.git
|
||||
$ cd x264
|
||||
$ ./configure --enable-static --enable-shared
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
最后,要让其他的程序可以访问到位于 /usr/local/lib的x264库,在 /etc/ld.so.conf加入下面的行。
|
||||
|
||||
$ sudo vi /etc/ld.so.conf
|
||||
|
||||
----------
|
||||
|
||||
/usr/local/lib
|
||||
|
||||
最后运行下面的命令重新加载共享库:
|
||||
|
||||
$ sudo ldconfig
|
||||
|
||||

|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/fatal-error-x264-h-no-such-file-or-directory.html
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.videolan.org/developers/x264.html
|
||||
[2]:http://ask.xmodulo.com/compile-ffmpeg-centos-fedora-rhel.html
|
||||
[3]:http://xmodulo.com/how-to-install-handbrake-on-linux.html
|
||||
[4]:http://xmodulo.com/how-to-install-rpm-fusion-on-fedora.html
|
Loading…
Reference in New Issue
Block a user