mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
20150520-1 选题
This commit is contained in:
parent
6ea3c8e962
commit
4b93be5c46
@ -0,0 +1,57 @@
|
|||||||
|
Is Linux Better than OS X? GNU, Open Source and Apple in History
|
||||||
|
================================================================================
|
||||||
|
> Tensions between the free software/open source community and Apple date back to the 1980s, Linux's founder called the core of Mac OS X "a piece of crap" and other anecdotes from software history.
|
||||||
|
|
||||||
|
![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/05/untitled_2.png)
|
||||||
|
|
||||||
|
Open source fans have long had a rocky relationship with Microsoft. Everyone knows that. But, in many ways, the tension between Apple and supporters of free or open source software is even starker—even if it receives much less attention in the press.
|
||||||
|
|
||||||
|
To be sure, not all open source advocates have an aversion to Apple. Anecdotally, I've seen plenty of Linux hackers sporting iPhones and iPads. In fact, some Linux users like Apple's OS X so much that they've [created a number of Linux distributions][1] designed to look just like it. (So has the [North Korean government][2], incidentally.)
|
||||||
|
|
||||||
|
But relations between the Cult of Mac and the Cult of Tux—that is, the Linux community (not to mention the other, smaller segments of the free and open source software world)—have not always been completely peaceable. And that's by no means a new phenomenon, as I'm discovering as I research the history of Linux and the Free Software Foundation.
|
||||||
|
|
||||||
|
### GNU vs. Apple ###
|
||||||
|
|
||||||
|
The ill will dates to at least the late 1980s. By June 1988, [GNU][3], the project launched by Richard Stallman to build a completely free Unix-like operating system whose source code would be freely shared, was [strongly criticizing][4] Apple's lawsuit against [Hewlett-Packard][5] (HPQ) and [Microsoft][6] (MSFT) over what Apple claimed was improper copying of the "look and feel" of the Macintosh operating system. If Apple prevailed, GNU warned, the company "will use this new power over the public to put an end to free software that could substitute for commercial software."
|
||||||
|
|
||||||
|
At the time, GNU fought against the lawsuit (which meant, ironically, that GNU was supporting Microsoft, though those were different times) by distributing "[Keep Your Lawyers Off My Computer" buttons][7]. It also urged GNU supporters to boycott Apple, warning that, even if Macintoshes seemed like good computers, Apple's success in the lawsuit could provide the company with a monopoly in the market that would greatly increase the price of computers.
|
||||||
|
|
||||||
|
Apple eventually [lost the lawsuit][8], but not until 1994, after which GNU [dropped its Apple boycott][9]. In the interim, GNU remained critical of the company. In the early 1990s, even after it began promoting GNU software programs for use on other personal computing platforms, including MS-DOS PCs, [GNU affirmed][10] that, until Apple ceased pursuing a "monopoly" over computers with user interfaces similar to those of the Macintosh, "we will not provide any support for Apple machines." (It's therefore ironic that a fair amount of the software that made it into OS X, the Unix-like operating system that Apple introduced later in the 1990s, came from GNU. But that's another story.)
|
||||||
|
|
||||||
|
### Torvalds on Jobs ###
|
||||||
|
|
||||||
|
Despite his more laissez-faire attitude toward most issues, Linus Torvalds, the creator of the Linux kernel, was no less charitable in his attitudes toward Apple than Stallman and GNU had been. In his 2001 book "Just for Fun: The Story of an Accidental Revolutionary," Torvalds described meeting with Steve Jobs circa 1997, at the latter's invitation, to discuss Mac OS X, which Apple was then developing but had not yet released publicly.
|
||||||
|
|
||||||
|
"Basically, Jobs started off by trying to tell me that on the desktop there were just two players, Microsoft and Apple, and that he thought that the best thing I could do for Linux was to get in bed with Apple and try to get the open source people behind Mac OS X," Torvalds wrote.
|
||||||
|
|
||||||
|
This courting apparently turned Torvalds off quite a bit. One point of disagreement centered on Torvalds's technical disdain for Mach, the kernel on which Apple was then building its new OS X operating system, which Torvalds called "a piece of crap. It contains all the design mistakes you can make, and managed to even make up a few of its own."
|
||||||
|
|
||||||
|
But more off-putting, apparently, was the way Jobs was approaching open source in developing OS X (which had many open source programs at its core): "He sort of played down the flaw in the setup: Who cares if the basic operating system, the real low-core stuff, is open source if you then have the Mac layer on top, which is not open source?"
|
||||||
|
|
||||||
|
All in all, Torvalds concluded, Jobs "didn't use very many arguments. He just basically took it for granted that I would be interested" in collaborating with Apple. "He was clueless, unable to imagine that there could be entire segments of the human race who weren't the least bit concerned about increasing the Mac's market share. I think he was truly surprised at how little I cared about how big a market the Mac had—or how big a market Microsoft has."
|
||||||
|
|
||||||
|
Torvalds doesn't speak for all Linux users, of course. And his views on OS X and Apple may have softened since 2001. But the fact that, in the early 2000s, the Linux community's leading figure exhibited so much disdain for Apple and the hubris of its chief says something significant about how deeply seated tensions between the Apple world and the open source/free software world are.
|
||||||
|
|
||||||
|
Both of these historical tidbits offer insight into the great debate regarding the actual value of Apple's products—whether the company thrives on the quality of the hardware and software it creates, or merely benefits from exceptional marketing acumen that allows it to sell products for much more than their non-Apple functional equivalents are worth. But I'll stay out of that debate, for now.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://thevarguy.com/open-source-application-software-companies/051815/linux-better-os-x-gnu-open-source-and-apple-
|
||||||
|
|
||||||
|
作者:[Christopher Tozzi][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:http://thevarguy.com/author/christopher-tozzi
|
||||||
|
[1]:https://www.linux.com/news/software/applications/773516-the-mac-ifying-of-the-linux-desktop/
|
||||||
|
[2]:http://thevarguy.com/open-source-application-software-companies/010615/north-koreas-red-star-linux-os-made-apples-image
|
||||||
|
[3]:http://gnu.org/
|
||||||
|
[4]:https://www.gnu.org/bulletins/bull5.html
|
||||||
|
[5]:http://www.hp.com/
|
||||||
|
[6]:http://www.microsoft.com/
|
||||||
|
[7]:http://www.duntemann.com/AppleSnakeButton.jpg
|
||||||
|
[8]:http://www.freibrun.com/articles/articl12.htm
|
||||||
|
[9]:https://www.gnu.org/bulletins/bull18.html#SEC6
|
||||||
|
[10]:https://www.gnu.org/bulletins/bull12.html
|
@ -0,0 +1,147 @@
|
|||||||
|
How to Use Docker Machine with a Cloud Provider
|
||||||
|
================================================================================
|
||||||
|
Hi everyone, today we'll learn how we can use Docker Machine to deploy Docker host in various Cloud Provider Platforms. Docker Machine is an application that helps to create Docker hosts on our computer, on cloud providers and inside our own data center. It provides easy solution for creating servers, installing Docker on them and then configuring the Docker client according the users configuration and requirements. The driver APIs works for provisioning Docker on a local machine, on a virtual machine in the data center, or on a public cloud instance. Docker Machine is supported on Windows, OSX, and Linux and is available for installation as one standalone binary. It enables us to take full advantage of ecosystem partners providing Docker-ready infrastructure, while still accessing everything through the same interface. It makes people able to deploy the docker containers in the respective cloud platform pretty fast and in pretty easy way with just a single command.
|
||||||
|
|
||||||
|
### 1. Installing Docker Machine ###
|
||||||
|
|
||||||
|
Docker Machine supports awesome on every Linux Operating System. First of all, we'll need to download the latest version of Docker Machine from the Github site . Here, we'll use curl to download the latest version of Docker Machine ie 0.2.0 .
|
||||||
|
|
||||||
|
For 64 Bit Operating System
|
||||||
|
|
||||||
|
# curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-amd64 > /usr/local/bin/docker-machine
|
||||||
|
|
||||||
|
For 32 Bit Operating System
|
||||||
|
|
||||||
|
# curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-i386 > /usr/local/bin/docker-machine
|
||||||
|
|
||||||
|
After downloading the latest release of Docker Machine, we'll make the file named docker-machine under /usr/local/bin/ executable using the command below.
|
||||||
|
|
||||||
|
# chmod +x /usr/local/bin/docker-machine
|
||||||
|
|
||||||
|
After doing the above, we'll wanna ensure that we have successfully installed docker-machine. To check it, we can run the docker-machine -v which will give output of the version of docker-machine installed in our system.
|
||||||
|
|
||||||
|
# docker-machine -v
|
||||||
|
|
||||||
|
![Installing Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/installing-docker-machine.png)
|
||||||
|
|
||||||
|
To enable Docker commands on our machines, make sure to install the Docker client as well by running the command below.
|
||||||
|
|
||||||
|
# curl -L https://get.docker.com/builds/linux/x86_64/docker-latest > /usr/local/bin/docker
|
||||||
|
# chmod +x /usr/local/bin/docker
|
||||||
|
|
||||||
|
### 2. Creating Machine ###
|
||||||
|
|
||||||
|
After finish installing Docker Machine in our Linux box, we'll wanna deploy a docker host into the cloud server. Docker Machine includes drivers for several popular Cloud Platforms such as Digital Ocean, Amazon Web Services (AWS), Microsoft Azure, Google Cloud Computing and many other which enables us to create same interface of docker deployment in different platforms. So, here in this tutorial we'll gonna deploy the Docker Host into the Digital Ocean server using digitalocean driver API. Here, we'll need to run command docker-machine create followed by --driver flag as digitalocean with --digitalocean-access-token flag as the API Token provided by the [Digital Ocean Control Panel][1] and at last the name of the docker host we just created. To do so, we'll need to run the following command as.
|
||||||
|
|
||||||
|
# docker-machine create --driver digitalocean --digitalocean-access-token <API-Token> linux-dev
|
||||||
|
|
||||||
|
# eval "$(docker-machine env linux-dev)"
|
||||||
|
|
||||||
|
![Docker Machine Digitalocean Cloud](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-digitalocean-cloud.png)
|
||||||
|
|
||||||
|
**Note**: Here, linux-dev is the name of the machine we are wanting to create. <API-Token> is a security key which can be generated from the Digital Ocean Control Panel of the account holder of Digital Ocean Cloud Platform. To retrieve that key, we simply need to login to our Digital Ocean Control Panel then click on API, then click on Generate New Token and give it a name tick on both Read and Write. Then we'll get a long hex key, thats the <API-Token> now, simply replace it into the command above.
|
||||||
|
|
||||||
|
After running the above command, we can see in our Digital Ocean Droplet Panel that a droplet has been created with default configuration.
|
||||||
|
|
||||||
|
![DigitalOcean Droplet Panel](http://blog.linoxide.com/wp-content/uploads/2015/05/digitalocean-droplet-panel.png)
|
||||||
|
|
||||||
|
For ease and convenience, docker-machine deploys the droplet with default configuration choosing setting such as images that the VPS is based on we can override the default configuration as our need. We can do that by simply adding the flags respective to our need and requirement of the Droplet. Here are some flags for digitalocean that we can add to override the default configuration of the Docker Machine.
|
||||||
|
|
||||||
|
--digitalocean-image "ubuntu-14-04-x64" for Choosing Droplet Image
|
||||||
|
--digitalocean-ipv6 enable to enable IPv6 Networking
|
||||||
|
--digitalocean-private-networking enable to enable Private Networking
|
||||||
|
--digitalocean-region "nyc3" to choose Region to deploy the Droplet
|
||||||
|
--digitalocean-size "512mb" to select the RAM size and type of deployment.
|
||||||
|
|
||||||
|
If you are wanting to use docker-machine with other cloud providers and need to override the default configuration, we can run following command to get the list of flags for every platforms supported by Docker Machine by default.
|
||||||
|
|
||||||
|
# docker-machine create -h
|
||||||
|
|
||||||
|
### 3. Selecting Active Host ###
|
||||||
|
|
||||||
|
After deploying the droplet, we wanna run a docker container straight away but before that, we'll need to check whether the active host is the required machine or not. To see that, we can run the following command.
|
||||||
|
|
||||||
|
# docker-machine ls
|
||||||
|
|
||||||
|
![Docker Machine List](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-ls.png)
|
||||||
|
|
||||||
|
The active host can be identified by "*" in the ACTIVE column.
|
||||||
|
|
||||||
|
Now, if we need to switch the active host to the required machine, we can simply run the following command.
|
||||||
|
|
||||||
|
# docker-machine active linux-dev
|
||||||
|
|
||||||
|
**Note**: Here, linux-dev is the Machine name that we are wanting to make as ACTIVE and run Docker Container on top of it.
|
||||||
|
|
||||||
|
### 4. Running a Docker Container ###
|
||||||
|
|
||||||
|
Now, after selecting our active host, we'll wanna finally run a docker container out of the box. Now, to give it a test, we'll run a busybox container out of it by running docker run busybox command with echo hello world so that we can get the output of the container.
|
||||||
|
|
||||||
|
# docker run busybox echo hello world
|
||||||
|
|
||||||
|
Note: If you are trying to deploy a docker container using a 32 Bit Operating System running in the host, its good idea to use SSH to run the docker commands. So, you can simply skip this step and follow the SSH step.
|
||||||
|
|
||||||
|
### 5. SSH with Docker Machine ###
|
||||||
|
|
||||||
|
If we want to control over the machine or the droplet that we just deployed with Docker Machine, we can ssh into the server using docker-machine ssh as command.
|
||||||
|
|
||||||
|
# docker-machine ssh
|
||||||
|
|
||||||
|
![Docker Machine SSH](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-ssh.png)
|
||||||
|
|
||||||
|
Now, after ssh into the machine, we can run any docker containers into it. Here we'll run an nginx server into it.
|
||||||
|
|
||||||
|
# docker run -itd -p 80:80 nginx
|
||||||
|
|
||||||
|
After finishing up with SSH, we need to run exit to exit from the droplet or server.
|
||||||
|
|
||||||
|
# exit
|
||||||
|
|
||||||
|
### 5. Removing Hosts ###
|
||||||
|
|
||||||
|
In order to remove the active host and all its images, containers, we can use docker-machine rm command as shown below.
|
||||||
|
|
||||||
|
# docker-machine rm linux-dev
|
||||||
|
|
||||||
|
![Docker Machine Remove All](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-remove-machine.png)
|
||||||
|
|
||||||
|
To check whether the host has been removed or not, we can run docker-machine ls command.
|
||||||
|
|
||||||
|
# docker-machine ls
|
||||||
|
|
||||||
|
![Docker Machine Remove Check](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-remove-check.png)
|
||||||
|
|
||||||
|
### 6. Adding a host without a driver ###
|
||||||
|
|
||||||
|
We can add a host to Docker which only has a URL and no driver. It can be used an alias for an existing host, so we don’t have to type out the URL every time we run a Docker command.
|
||||||
|
|
||||||
|
$ docker-machine create --url=tcp://104.131.50.36:2376 custombox
|
||||||
|
|
||||||
|
### 7. Managing the Hosts ###
|
||||||
|
|
||||||
|
If you are finished working with the running docker, we can simply run **docker-machine stop** command to stop the whole hosts which are Active and if wanna start again, we can run **docker-machine start**.
|
||||||
|
|
||||||
|
# docker-machine stop
|
||||||
|
# docker-machine start
|
||||||
|
|
||||||
|
You can also specify a machine name to stop or start using the host name as an argument.
|
||||||
|
|
||||||
|
$ docker-machine stop linux-dev
|
||||||
|
$ docker-machine start linux-dev
|
||||||
|
|
||||||
|
### Conclusion ###
|
||||||
|
|
||||||
|
Docker Machine is really and awesome tool for deploying servers with Docker Container running. In this article we demostrated with Digital Ocean Platform but there are other platforms also available like Amazon Web Service, Google Cloud Computing and more which is supported by Docker Machine and includes driver APIs of them. It has made easy for fast and secure deployment of Docker Containers into several different Platforms with Docker Machine. As Docker Machine is still under Beta, so it is recommended not to use docker-machine in production. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-)
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://linoxide.com/linux-how-to/use-docker-machine-cloud-provider/
|
||||||
|
|
||||||
|
作者:[Arun Pyasi][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/arunp/
|
||||||
|
[1]:https://cloud.digitalocean.com/settings/applications
|
@ -0,0 +1,64 @@
|
|||||||
|
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 it’s 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/
|
@ -0,0 +1,167 @@
|
|||||||
|
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
|
@ -0,0 +1,170 @@
|
|||||||
|
Shell Script to Backup Files / Directories Using rsync
|
||||||
|
================================================================================
|
||||||
|
This article we bring shell scripts to backup your files / directories from you local linux machine to a remote linux server using rsync command. This would be an interactive way to perform backup , where you need to provide remote backup server hostname / ip address and folder location. We keep a separate file where you need to provide files / directories that need backup. We have added two scripts where **first script** ask password after each file had been copied (if you have enabled ssh authentication keys , then password will be not be asked) and in second script password will be prompted only once.
|
||||||
|
|
||||||
|
We are going to backup bckup.txt, dataconfig.txt, docs and oracledb.
|
||||||
|
|
||||||
|
[root@Fedora21 tmp]# ls -l
|
||||||
|
total 12
|
||||||
|
-rw-r--r--. 1 root root 0 May 15 10:43 bckrsync.sh
|
||||||
|
-rw-r--r--. 1 root root 0 May 15 10:44 bckup.txt
|
||||||
|
-rw-r--r--. 1 root root 0 May 15 10:46 dataconfig.txt
|
||||||
|
drwxr-xr-x. 2 root root 4096 May 15 10:45 docs
|
||||||
|
drwxr-xr-x. 2 root root 4096 May 15 10:44 oracledb
|
||||||
|
|
||||||
|
This file contains backup files / dir details
|
||||||
|
|
||||||
|
[root@Fedora21 tmp]# cat /tmp/bckup.txt
|
||||||
|
/tmp/oracledb
|
||||||
|
/tmp/dataconfig.txt
|
||||||
|
/tmp/docs
|
||||||
|
[root@Fedora21 tmp]#
|
||||||
|
|
||||||
|
### Script 1 : ###
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#We will save path to backup file in variable
|
||||||
|
backupf='/tmp/bckup.txt'
|
||||||
|
|
||||||
|
#Next line just prints message
|
||||||
|
echo "Shell Script Backup Your Files / Directories Using rsync"
|
||||||
|
|
||||||
|
#next line check if entered value is not null, and if null it will reask user to enter Destination Server
|
||||||
|
while [ x$desthost = "x" ]; do
|
||||||
|
|
||||||
|
#next line prints what userd should enter, and stores entered value to variable with name desthost
|
||||||
|
read -p "Destination backup Server : " desthost
|
||||||
|
|
||||||
|
#next line finishes while loop
|
||||||
|
done
|
||||||
|
|
||||||
|
#next line check if entered value is not null, and if null it will reask user to enter Destination Path
|
||||||
|
while [ x$destpath = "x" ]; do
|
||||||
|
|
||||||
|
#next line prints what userd should enter, and stores entered value to variable with name destpath
|
||||||
|
read -p "Destination Folder : " destpath
|
||||||
|
|
||||||
|
#next line finishes while loop
|
||||||
|
done
|
||||||
|
|
||||||
|
#Next line will start reading backup file line by line
|
||||||
|
for line in `cat $backupf`
|
||||||
|
|
||||||
|
#and on each line will execute next
|
||||||
|
do
|
||||||
|
|
||||||
|
#print message that file/dir will be copied
|
||||||
|
echo "Copying $line ... "
|
||||||
|
#copy via rsync file/dir to destination
|
||||||
|
|
||||||
|
rsync -ar "$line" "$desthost":"$destpath"
|
||||||
|
|
||||||
|
#this line just print done
|
||||||
|
echo "DONE"
|
||||||
|
|
||||||
|
#end of reading backup file
|
||||||
|
done
|
||||||
|
|
||||||
|
#### Running the script with output ####
|
||||||
|
|
||||||
|
[root@Fedora21 tmp]# ./bckrsync.sh
|
||||||
|
Shell Script Backup Your Files / Directories Using rsync
|
||||||
|
Destination backup Server : 104.*.*.41
|
||||||
|
Destination Folder : /tmp
|
||||||
|
Copying /tmp/oracledb ...
|
||||||
|
The authenticity of host '104.*.*.41 (104.*.*.41)' can't be established.
|
||||||
|
ECDSA key fingerprint is 96:11:61:17:7f:fa:......
|
||||||
|
Are you sure you want to continue connecting (yes/no)? yes
|
||||||
|
Warning: Permanently added '104.*.*.41' (ECDSA) to the list of known hosts.
|
||||||
|
root@104.*.*.41's password:
|
||||||
|
DONE
|
||||||
|
Copying /tmp/dataconfig.txt ...
|
||||||
|
root@104.*.*.41's password:
|
||||||
|
DONE
|
||||||
|
Copying /tmp/docs ...
|
||||||
|
root@104.*.*.41's password:
|
||||||
|
DONE
|
||||||
|
[root@Fedora21 tmp]#
|
||||||
|
|
||||||
|
### Script 2 : ###
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#We will save path to backup file in variable
|
||||||
|
backupf='/tmp/bckup.txt'
|
||||||
|
|
||||||
|
#Next line just prints message
|
||||||
|
echo "Shell Script Backup Your Files / Directories Using rsync"
|
||||||
|
|
||||||
|
#next line check if entered value is not null, and if null it will reask user to enter Destination Server
|
||||||
|
while [ x$desthost = "x" ]; do
|
||||||
|
|
||||||
|
#next line prints what userd should enter, and stores entered value to variable with name desthost
|
||||||
|
read -p "Destination backup Server : " desthost
|
||||||
|
|
||||||
|
#next line finishes while loop
|
||||||
|
done
|
||||||
|
|
||||||
|
#next line check if entered value is not null, and if null it will reask user to enter Destination Path
|
||||||
|
while [ x$destpath = "x" ]; do
|
||||||
|
|
||||||
|
#next line prints what userd should enter, and stores entered value to variable with name destpath
|
||||||
|
read -p "Destination Folder : " destpath
|
||||||
|
|
||||||
|
#next line finishes while loop
|
||||||
|
done
|
||||||
|
|
||||||
|
#next line check if entered value is not null, and if null it will reask user to enter password
|
||||||
|
while [ x$password = "x" ]; do
|
||||||
|
#next line prints what userd should enter, and stores entered value to variable with name password. #To hide password we are using -s key
|
||||||
|
read -sp "Password : " password
|
||||||
|
#next line finishes while loop
|
||||||
|
done
|
||||||
|
|
||||||
|
#Next line will start reading backup file line by line
|
||||||
|
for line in `cat $backupf`
|
||||||
|
|
||||||
|
#and on each line will execute next
|
||||||
|
do
|
||||||
|
|
||||||
|
#print message that file/dir will be copied
|
||||||
|
echo "Copying $line ... "
|
||||||
|
#we will use expect tool to enter password inside script
|
||||||
|
/usr/bin/expect << EOD
|
||||||
|
#next line set timeout to -1, recommended to use
|
||||||
|
set timeout -1
|
||||||
|
#copy via rsync file/dir to destination, using part of expect — spawn command
|
||||||
|
|
||||||
|
spawn rsync -ar ${line} ${desthost}:${destpath}
|
||||||
|
#as result of previous command we expect “password” promtp
|
||||||
|
expect "*?assword:*"
|
||||||
|
#next command enters password from script
|
||||||
|
send "${password}\r"
|
||||||
|
#next command tells that we expect end of file (everything finished on remote server)
|
||||||
|
expect eof
|
||||||
|
#end of expect pard
|
||||||
|
EOD
|
||||||
|
#this line just print done
|
||||||
|
echo "DONE"
|
||||||
|
|
||||||
|
#end of reading backup file
|
||||||
|
done
|
||||||
|
|
||||||
|
#### Screenshot running the second script with output ####
|
||||||
|
|
||||||
|
![rsync script](http://blog.linoxide.com/wp-content/uploads/2015/05/bckuprsync-script.png)
|
||||||
|
|
||||||
|
Hope these scripts help you to take backup !!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://linoxide.com/linux-shell-script/shell-script-backup-files-directories-rsync/
|
||||||
|
|
||||||
|
作者:[Yevhen Duma][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/yevhend/
|
Loading…
Reference in New Issue
Block a user