Merge pull request #2811 from geekpi/master

translated
This commit is contained in:
geekpi 2015-05-21 21:52:36 +08:00
commit dbd3a3a019
4 changed files with 231 additions and 235 deletions

View File

@ -1,66 +0,0 @@
translating----geekpi
How to Use tmpfs on RHEL / CentOS 7.0
================================================================================
Today we will talk about tmpfs CentOS 7 a file system that will keep all files and folders in the virtual memory of the operating system as opposed to actually writing them to the disk. This means that all the content in tmpfs is temporary in the sense that its not permanently written to the disk and in case the tmpfs is unmounted, the system is rebooted or the power is cut all content will be lost. From a technical point of view tmpfs puts everything in the kernel internal cache and then grows or shrinks to accommodate the files it contains ans is able to swap unneeded pages out of swap space.
By default CentOS uses tmpfs for various things as you can see from the output of the df h command:
# df h
![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs1.jpg)
/dev - directory contains the special device files for all the devices.
/dev/shm contains shared memory allocation
/run - used for system logs
/sys/fs/cgroup - used for cgroups, a kernel feature to limit, police and account the resource usage of certain processes
One use of tmpfs is to obviously use it as a /tmp folder, you can do this in 2 ways:
### Using systemctl to enable tmpfs in /tmp ###
You can use the systemctl command to enable tmpfs in the /tmp folder, first use the following command to check if this feature is not already enabled:
# systemctl is-enabled tmp.mount
Will show the current status of settings you can use the following command to enable it:
# systemctl enable tmp.mount
![systemctl](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs3.jpg)
This will have the system controlling the /tmp folder and mount a tmpfs in it.
### Manually mounting a /tmp/fs ###
You can also manually add a tmpfs in /tmp by adding the following line to /etc/fstab:
tmpfs /tmp tmpfs size=512m 0 0
And then running the mount command like this:
# mount a
![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs2.jpg)
This should make the tmpfs show in df h, also it will automatically mount it the next time you reboot.
### Creating a tmpfs on the fly ###
If for some reason you wish to create a tmpfs in a folder on the fly you can always use the following command:
# mount -t tmpfs -o size=1G tmpfs /mnt/mytmpfs
Of course you can specify any size you wish in the size option and any mount point you wish, just remember it must be a valid directory.
--------------------------------------------------------------------------------
via: http://linoxide.com/file-system/use-tmpfs-rhel-centos-7-0/
作者:[Adrian Dinu][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/adriand/

View File

@ -1,169 +0,0 @@
translating---geekpi
How to compile and install wxWidgets on Ubuntu/Debian/Linux Mint
================================================================================
### wxWidgets ###
wxWidgets is an application development framework/library that allows developer to make cross platform GUI applications for Windows, Mac and Linux using the same codebase.
Its primarily written in C++ but has bindings for other languages as well like Python, Perl and Ruby.
In this tutorial I am going to show you how to compile and build wxwidgets 3.0+ on Debian based linux systems like Ubuntu and Linux Mint.
Compiling wxWidgets from source is not at all difficult as it might sound and takes only a few minutes to do.
The library can be compiled in different modes like static library or dynamic library.
### 1. Download wxWidgets ###
The first step would be to download the wxWidgets source files from [wxwidgets.org][1]
Once done, extract the files to a directory.
### 2. Setup build environment ###
To compile wxwidgets we would need some utility programs including the C++ compiler on Linux called g++. And all of it would be installed from the repositories using apt-get.
We also need the GTK development libraries which wxWidgets depend on.
$ sudo apt-get install libgtk-3-dev build-essential checkinstall
> The utility called checkinstall would allow us to create an installation package for wxwidgets, so that later on it can un-installed easily using package managers
### 3. Compile wxWidgets ###
Get inside the directory where wxWidgets is extracted. In order to keep things clean, create a directory where the compilation would be done.
$ mkdir gtk-build
$ cd gtk-build/
Now run the configure and make commands one by one. Each one would take some time to finish.
$ ../configure --disable-shared --enable-unicode
$ make
The "--disable-shared" option instructs wxwidgets to builds static libraries instead of shared/dynamic ones.
After the make command finishes, the compilation is done successfully. Its time to install the wxWidgets files to the correct location.
More information about compile options can be found in install.txt and readme.txt files that can be found in /docs/gtk/ inside the wxwidgets directory.
### 4. Install with checkinstall ###
Now instead of using the "make install" command, we shall use the checkinstall command to create a deb package for wxwidgets. Run the following command
$ sudo checkinstall
Checkinstall would ask few questions during the process and make sure to provide a version number when asked, otherwise it would fail.
Once the process is over, wxWidgets would be installed and also a deb file would be created in the same directory.
### 5. Track the installed files ###
If you wish to check where the files are installed, use the dpkg command followed by the name of the package provided during the checkinstall process.
$ dpkg -L package_name
/.
/usr
/usr/local
/usr/local/lib
/usr/local/lib/libwx_baseu-3.0.a
/usr/local/lib/libwx_gtk3u_propgrid-3.0.a
/usr/local/lib/libwx_gtk3u_html-3.0.a
/usr/local/lib/libwxscintilla-3.0.a
/usr/local/lib/libwx_gtk3u_ribbon-3.0.a
/usr/local/lib/libwx_gtk3u_stc-3.0.a
/usr/local/lib/libwx_gtk3u_qa-3.0.a
/usr/local/lib/libwx_baseu_net-3.0.a
/usr/local/lib/libwxtiff-3.0.a
### 6. Compile the samples ###
After compiling wxWidgets, its time to compile the sample programs to see it in action. In the same directory where we compiled wxwidgets, a new subdirectory called samples would have been created.
Just enter it and run the make command
$ compile samples
$ cd samples/
$ make
After the make process finishes, get inside each sample sub directory and there should be an executable file that can be run right away to see the demo.
### 7. Compile your first program ###
After you are done with the demo programs, its time to write your own program and compile it. Again it is quite easy.
It is assumed that you are coding in C++ and for that you can use any good editor with syntax highlighting feature. For example gedit, kate, kwrite would do. Or you might want to try fully loaded IDEs like Geany, Codelite, Codeblocks etc.
However for your first program just use an ordinary text editor get it done quick.
Here it is
#include <wx/wx.h>
class Simple : public wxFrame
{
public:
Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
};
class MyApp : public wxApp
{
public:
bool OnInit()
{
Simple *simple = new Simple(wxT("Simple"));
simple->Show(true);
return true;
}
};
wxIMPLEMENT_APP(MyApp);
Now save the program somewhere and compile it with the following commands
# compile
$ g++ basic.cpp `wx-config --cxxflags --libs std` -o program
# run
$ ./program
#### Compiling with non standard libraries ####
The wx-config command shown above provides only the standard libraries by default. If you are using the Aui classes for example, then you need to specify additional libraries for it
$ g++ code.cpp `wx-config --cxxflags --libs std,aui` -o program
More information can be found [here][2].
### Resources ###
Download source and help files for wxWidgets
[https://www.wxwidgets.org/downloads/][3]
wxWidgets wiki page on compile instructions
[https://wiki.wxwidgets.org/Compiling_and_getting_started][4]
Notes on how to use the latest wxWidgets version (3.0+)
[https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets][5]
--------------------------------------------------------------------------------
via: http://www.binarytides.com/install-wxwidgets-ubuntu/
作者:[Silver Moon][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117145272367995638274/posts
[1]:https://www.wxwidgets.org/downloads/
[2]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets#The_wx-config_script
[3]:https://www.wxwidgets.org/downloads/
[4]:https://wiki.wxwidgets.org/Compiling_and_getting_started
[5]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets

View File

@ -0,0 +1,64 @@
如何在RHEL/CentOS 7.0中使用tmpfs
================================================================================
7中的tmpfs这是一个将所有文件和文件夹写到虚拟内存中而不是实际写到磁盘中的虚拟文件系统。这意味中tmpfs中所有的内容都是临时的在取消挂载、系统重启或者电源切断后内容都将会丢失。技术的角度上来说tmpfs将搜有的内容放在内核内部缓存中并且会增大或者缩小来容纳文件并可从交换空间中交换处不需要的页。
CentOS默认使用tmpfs做的事可用df -h命令的输出来看
# df h
![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs1.jpg)
/dev - 含有针对所有设备的设备文件的目录
/dev/shm 包含共享内存分配
/run - 用于系统日志
/sys/fs/cgroup - 用于cgrpups 一个针对特定进程限制、管制和审计资源利用的内核特性
/tmp目录 你可以用下面的两种方法来做到:
### 使用systemctl来在/tmp中启用tmpfs ###
你可以使用systemctl命令在tmp目录启用tmpfs 首先用下面的命令来检查这个特性是否可用:
# systemctl is-enabled tmp.mount
这会显示当先的状态,你可以使用下面的命令来启用它:
# systemctl enable tmp.mount
![systemctl](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs3.jpg)
这会控制/tmp目录并挂载tmpfs。
### 手动挂载/tmp/文件系统 ###
你可以在/etc/fstab中添加下面这行在/tmp挂载tmpfs。
tmpfs /tmp tmpfs size=512m 0 0
接着运行这条命令
# mount a
![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs2.jpg)
这应该就会在df -h中显示tmpfs了同样也会在你下次重启是会自动挂载。
### 立即创建tmpfs ###
如果由于一些原因你写昂立即创建tmpfs你可以使用下面的命令
# mount -t tmpfs -o size=1G tmpfs /mnt/mytmpfs
当然你可以在size选项中指定你希望的大小和希望的挂载点只要记住是有效的目录就行了。
--------------------------------------------------------------------------------
via: http://linoxide.com/file-system/use-tmpfs-rhel-centos-7-0/
作者:[Adrian Dinu][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/adriand/

View File

@ -0,0 +1,167 @@
如何在Ubuntu/Debian/Linux Mint中编译和安装wxWidgets
================================================================================
### wxWidgets ###
wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中使用相同的代码跨平台开发。
它主要用C++写成但也可以与其他语言绑定比如Python、Perl、Ruby。
本教程中我将向你展示如何在基于Debian的linux中如Ubuntu和Linux Mint中编译wxwidgets 3.0+。
从源码编译wxWidgets并不困难仅仅需要几分钟。
库可以按不同的方式来编译,比如静态或者动态库。
### 1. 下载 wxWidgets ###
第一步你需要从[wxwidgets.org][1]下载wxWidgets源码文件。
做完后,解压到目录。
### 2. 设置编译环境 ###
要编译wxwidgets我们需要一些工具包括C++编译器, 在Linux上是g++。所有这些可以通过apt-get工具从仓库中安装。
我们还需要wxWidgets依赖的GTK开发库。
$ sudo apt-get install libgtk-3-dev build-essential checkinstall
>checkinstall工具允许我们为wxwidgets创建一个安装包这样之后就可以轻松的使用包管理器来卸载。
### 3. 编译 wxWidgets ###
进入到wxWidgets解压后的目录。为了保持清洁创建一个编译用的目录。
$ mkdir gtk-build
$ cd gtk-build/
现在运行configure和make命令。每个将花费一些时间来完成。
$ ../configure --disable-shared --enable-unicode
$ make
"--disable-shared"选项将会编译静态库而不是动态库。
make命令完成后编译也成功了。是时候安装wxWidgets到正确的目录。
更多信息请参考install.txt和readme.txt这可在wxwidgets中的/docs/gtk/目录下找到。
### 4. 安装 checkinstall ###
现在我们不使用"make install"命令我们使用checkinstall命令来创建一个wxwidgets的deb安装包。运行命令
$ sudo checkinstall
checkinstall会询问几个问题请保证在提问后提供一个版本号否则将会失败。
完成这一切后wxWidgets就安装好了deb文件也会创建在相同的目录下。
### 5. 追踪安装的文件 ###
如果你想要检查文件安装的位置使用dpkg命令后面跟上checkinstall提供的报名。
$ dpkg -L package_name
/.
/usr
/usr/local
/usr/local/lib
/usr/local/lib/libwx_baseu-3.0.a
/usr/local/lib/libwx_gtk3u_propgrid-3.0.a
/usr/local/lib/libwx_gtk3u_html-3.0.a
/usr/local/lib/libwxscintilla-3.0.a
/usr/local/lib/libwx_gtk3u_ribbon-3.0.a
/usr/local/lib/libwx_gtk3u_stc-3.0.a
/usr/local/lib/libwx_gtk3u_qa-3.0.a
/usr/local/lib/libwx_baseu_net-3.0.a
/usr/local/lib/libwxtiff-3.0.a
### 6. 编译示例 ###
编译wxWidgets完成后就可以马上编译示例程序了。在相同的目录下一个新的sample目录已经创建了。
进入它并运行下面的命令
$ compile samples
$ cd samples/
$ make
make命令完成后进入sampl子目录这里就有一个可以马上运行的Demo程序了。
### 7. 编译你的第一个程序 ###
你完成编译demo程序后可以写你自己的程序来编译了。这个也很简单。
假设你用的是C++这样你可以使用编辑器的高亮特性。比如gedit、kate、kwrite等等。或者用全功能的IDE像Geany、Codelite、Codeblocks等等。
然而你的第一个程序只需要用一个文本编辑器来快速完成。
这里就是
#include <wx/wx.h>
class Simple : public wxFrame
{
public:
Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
};
class MyApp : public wxApp
{
public:
bool OnInit()
{
Simple *simple = new Simple(wxT("Simple"));
simple->Show(true);
return true;
}
};
wxIMPLEMENT_APP(MyApp);
现在保存并用下面的命令编译。
# compile
$ g++ basic.cpp `wx-config --cxxflags --libs std` -o program
# run
$ ./program
#### 和非标准的库一起编译 ####
面展示的wx-config命令默认只支持标准的库。如果你使用的是Aui库那么你需要指定额外用到的库。
$ g++ code.cpp `wx-config --cxxflags --libs std,aui` -o program
更多的信息参考这里[这里][2]。
### 资源 ###
下载wxWidgets的源码和帮助
[https://www.wxwidgets.org/downloads/][3]
wxWidgets编译的wiki页面
[https://wiki.wxwidgets.org/Compiling_and_getting_started][4]
使用wxWidgets最新版本(3.0+)的事项
[https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets][5]
--------------------------------------------------------------------------------
via: http://www.binarytides.com/install-wxwidgets-ubuntu/
作者:[Silver Moon][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117145272367995638274/posts
[1]:https://www.wxwidgets.org/downloads/
[2]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets#The_wx-config_script
[3]:https://www.wxwidgets.org/downloads/
[4]:https://wiki.wxwidgets.org/Compiling_and_getting_started
[5]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets