Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2019-10-18 20:55:10 +08:00
commit efb5e7917c
10 changed files with 910 additions and 919 deletions

View File

@ -1,158 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What is a Java constructor?)
[#]: via: (https://opensource.com/article/19/6/what-java-constructor)
[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/ashleykoree)
What is a Java constructor?
======
Constructors are powerful components of programming. Use them to unlock
the full potential of Java.
![][1]
Java is (disputably) the undisputed heavyweight in open source, cross-platform programming. While there are many [great][2] [cross-platform][2] [frameworks][3], few are as unified and direct as [Java][4].
Of course, Java is also a pretty complex language with subtleties and conventions all its own. One of the most common questions about Java relates to **constructors** : What are they and what are they used for?
Put succinctly: a constructor is an action performed upon the creation of a new **object** in Java. When your Java application creates an instance of a class you have written, it checks for a constructor. If a constructor exists, Java runs the code in the constructor while creating the instance. That's a lot of technical terms crammed into a few sentences, but it becomes clearer when you see it in action, so make sure you have [Java installed][5] and get ready for a demo.
### Life without constructors
If you're writing Java code, you're already using constructors, even though you may not know it. All classes in Java have a constructor because even if you haven't created one, Java does it for you when the code is compiled. For the sake of demonstration, though, ignore the hidden constructor that Java provides (because a default constructor adds no extra features), and take a look at life without an explicit constructor.
Suppose you're writing a simple Java dice-roller application because you want to produce a pseudo-random number for a game.
First, you might create your dice class to represent a physical die. Knowing that you play a lot of [Dungeons and Dragons][6], you decide to create a 20-sided die. In this sample code, the variable **dice** is the integer 20, representing the maximum possible die roll (a 20-sided die cannot roll more than 20). The variable **roll** is a placeholder for what will eventually be a random number, and **rand** serves as the random seed.
```
import java.util.Random;
public class DiceRoller {
private int dice = 20;
private int roll;
private [Random][7] rand = new [Random][7]();
```
Next, create a function in the **DiceRoller** class to execute the steps the computer must take to emulate a die roll: Take an integer from **rand** and assign it to the **roll** variable, add 1 to account for the fact that Java starts counting at 0 but a 20-sided die has no 0 value, then print the results.
```
public void Roller() {
roll = rand.nextInt(dice);
roll += 1;
[System][8].out.println (roll);
}
```
Finally, spawn an instance of the **DiceRoller** class and invoke its primary function, **Roller** :
```
// main loop
public static void main ([String][9][] args) {
[System][8].out.printf("You rolled a ");
DiceRoller App = new DiceRoller();
App.Roller();
}
}
```
As long as you have a Java development environment installed (such as [OpenJDK][10]), you can run your application from a terminal:
```
$ java dice.java
You rolled a 12
```
In this example, there is no explicit constructor. It's a perfectly valid and legal Java application, but it's a little limited. For instance, if you set your game of Dungeons and Dragons aside for the evening to play some Yahtzee, you would need 6-sided dice. In this simple example, it wouldn't be that much trouble to change the code, but that's not a realistic option in complex code. One way you could solve this problem is with a constructor.
### Constructors in action
The **DiceRoller** class in this example project represents a virtual dice factory: When it's called, it creates a virtual die that is then "rolled." However, by writing a custom constructor, you can make your Dice Roller application ask what kind of die you'd like to emulate.
Most of the code is the same, with the exception of a constructor accepting some number of sides. This number doesn't exist yet, but it will be created later.
```
import java.util.Random;
public class DiceRoller {
private int dice;
private int roll;
private [Random][7] rand = new [Random][7]();
// constructor
public DiceRoller(int sides) {
dice = sides;
}
```
The function emulating a roll remains unchanged:
```
public void Roller() {
roll = rand.nextInt(dice);
roll += 1;
[System][8].out.println (roll);
}
```
The main block of code feeds whatever arguments you provide when running the application. Were this a complex application, you would parse the arguments carefully and check for unexpected results, but for this sample, the only precaution taken is converting the argument string to an integer type:
```
public static void main ([String][9][] args) {
[System][8].out.printf("You rolled a ");
DiceRoller App = new DiceRoller( [Integer][11].parseInt(args[0]) );
App.Roller();
}
}
```
Launch the application and provide the number of sides you want your die to have:
```
$ java dice.java 20
You rolled a 10
$ java dice.java 6
You rolled a 2
$ java dice.java 100
You rolled a 44
```
The constructor has accepted your input, so when the class instance is created, it is created with the **sides** variable set to whatever number the user dictates.
Constructors are powerful components of programming. Practice using them to unlock the full potential of Java.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/6/what-java-constructor
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth/users/ashleykoree
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag
[2]: https://opensource.com/resources/python
[3]: https://opensource.com/article/17/4/pyqt-versus-wxpython
[4]: https://opensource.com/resources/java
[5]: https://openjdk.java.net/install/index.html
[6]: https://opensource.com/article/19/5/free-rpg-day
[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random
[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
[10]: https://openjdk.java.net/
[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer

View File

@ -1,267 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (lnrCoder)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu)
[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/)
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
How to Install and Configure PostgreSQL on Ubuntu
======
_**In this tutorial, youll learn how to install and use the open source database PostgreSQL on Ubuntu Linux.**_
[PostgreSQL][1] (or Postgres) is a powerful, free and open-source relational database management system ([RDBMS][2]) that has a strong reputation for reliability, feature robustness, and performance. It is designed to handle various tasks, of any size. It is cross-platform, and the default database for [macOS Server][3].
PostgreSQL might just be the right tool for you if youre a fan of a simple to use SQL database manager. It supports SQL standards and offers additional features, while also being heavily extendable by the user as the user can add data types, functions, and do many more things.
Earlier I discussed [installing MySQL on Ubuntu][4]. In this article, Ill show you how to install and configure PostgreSQL, so that you are ready to use it to suit whatever your needs may be.
![][5]
### Installing PostgreSQL on Ubuntu
PostgreSQL is available in Ubuntu main repository. However, like many other development tools, it may not be the latest version.
First check the PostgreSQL version available in [Ubuntu repositories][6] using this [apt command][7] in the terminal:
```
apt show postgresql
```
In my Ubuntu 18.04, it showed that the available version of PostgreSQL is version 10 (10+190 means version 10) whereas PostgreSQL version 11 is already released.
```
Package: postgresql
Version: 10+190
Priority: optional
Section: database
Source: postgresql-common (190)
Origin: Ubuntu
```
Based on this information, you can make your mind whether you want to install the version available from Ubuntu or you want to get the latest released version of PostgreSQL.
Ill show both methods to you.
#### Method 1: Install PostgreSQL from Ubuntu repositories
In the terminal, use the following command to install PostgreSQL
```
sudo apt update
sudo apt install postgresql postgresql-contrib
```
Enter your password when asked and you should have it installed in a few seconds/minutes depending on your internet speed. Speaking of that, feel free to check various [network bandwidth in Ubuntu][8].
What is postgresql-contrib?
The postgresql-contrib or the contrib package consists some additional utilities and functionalities that are not part of the core PostgreSQL package. In most cases, its good to have the contrib package installed along with the PostgreSQL core.
[][9]
Suggested read  Fix gvfsd-smb-browse Taking 100% CPU In Ubuntu 16.04
#### Method 2: Installing the latest version 11 of PostgreSQL in Ubuntu
To install PostgreSQL 11, you need to add the official PostgreSQL repository in your sources.list, add its certificate and then install it from there.
Dont worry, its not complicated. Just follow these steps.
Add the GPG key first:
```
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
```
Now add the repository with the below command. If you are using Linux Mint, youll have to manually replace the `lsb_release -cs` the Ubuntu version your Mint release is based on.
```
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
```
Everything is ready now. Install PostgreSQL with the following commands:
```
sudo apt update
sudo apt install postgresql postgresql-contrib
```
PostgreSQL GUI application
You may also install a GUI application (pgAdmin) for managing PostgreSQL databases:
_sudo apt install pgadmin4_
### Configuring PostgreSQL
You can check if **PostgreSQL** is running by executing:
```
service postgresql status
```
Via the **service** command you can also **start**, **stop** or **restart** **postgresql**. Typing in **service postgresql** and pressing **Enter** should output all options. Now, onto the users.
By default, PostgreSQL creates a special user postgres that has all rights. To actually use PostgreSQL, you must first log in to that account:
```
sudo su postgres
```
Your prompt should change to something similar to:
```
[email protected]:/home/ubuntu$
```
Now, run the **PostgreSQL Shell** with the utility **psql**:
```
psql
```
You should be prompted with:
```
postgress=#
```
You can type in **\q** to **quit** and **\?** for **help**.
To see all existing tables, enter:
```
\l
```
The output will look similar to this (Hit the key **q** to exit this view):
![PostgreSQL Tables][10]
With **\du** you can display the **PostgreSQL users**:
![PostgreSQLUsers][11]
You can change the password of any user (including **postgres**) with:
```
ALTER USER postgres WITH PASSWORD 'my_password';
```
**Note:** _Replace **postgres** with the name of the user and **my_password** with the wanted password._ Also, dont forget the **;** (**semicolumn**) after every statement.
It is recommended that you create another user (it is bad practice to use the default **postgres** user). To do so, use the command:
```
CREATE USER my_user WITH PASSWORD 'my_password';
```
If you run **\du**, you will see, however, that **my_user** has no attributes yet. Lets add **Superuser** to it:
```
ALTER USER my_user WITH SUPERUSER;
```
You can **remove users** with:
```
DROP USER my_user;
```
To **log in** as another user, quit the prompt (**\q**) and then use the command:
```
psql -U my_user
```
You can connect directly to a database with the **-d** flag:
```
psql -U my_user -d my_db
```
You should call the PostgreSQL user the same as another existing user. For example, my use is **ubuntu**. To log in, from the terminal I use:
```
psql -U ubuntu -d postgres
```
**Note:** _You must specify a database (by default it will try connecting you to the database named the same as the user you are logged in as)._
If you have a the error:
```
psql: FATAL: Peer authentication failed for user "my_user"
```
Make sure you are logging as the correct user and edit **/etc/postgresql/11/main/pg_hba.conf** with administrator rights:
```
sudo vim /etc/postgresql/11/main/pg_hba.conf
```
**Note:** _Replace **11** with your version (e.g. **10**)._
Here, replace the line:
```
local all postgres peer
```
With:
```
local all postgres md5
```
Then restart **PostgreSQL**:
```
sudo service postgresql restart
```
Using **PostgreSQL** is the same as using any other **SQL** type database. I wont go into the specific commands, since this article is about getting you started with a working setup. However, here is a [very useful gist][12] to reference! Also, the man page (**man psql**) and the [documentation][13] are very helpful.
[][14]
Suggested read  [How To] Share And Sync Any Folder With Dropbox in Ubuntu
**Wrapping Up**
Reading this article has hopefully guided you through the process of installing and preparing PostgreSQL on an Ubuntu system. If you are new to SQL, you should read this article to know the [basic SQL commands][15]:
[Basic SQL Commands][15]
If you have any issues or questions, please feel free to ask in the comment section.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-postgresql-ubuntu/
作者:[Sergiu][a]
选题:[lujun9972][b]
译者:[lnrCoder](https://github.com/lnrCoder)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sergiu/
[b]: https://github.com/lujun9972
[1]: https://www.postgresql.org/
[2]: https://www.codecademy.com/articles/what-is-rdbms-sql
[3]: https://www.apple.com/in/macos/server/
[4]: https://itsfoss.com/install-mysql-ubuntu/
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1
[6]: https://itsfoss.com/ubuntu-repositories/
[7]: https://itsfoss.com/apt-command-guide/
[8]: https://itsfoss.com/network-speed-monitor-linux/
[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1
[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546
[13]: https://www.postgresql.org/docs/manuals/
[14]: https://itsfoss.com/sync-any-folder-with-dropbox/
[15]: https://itsfoss.com/basic-sql-commands/

View File

@ -1,191 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (amwps290)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install Linux on Intel NUC)
[#]: via: (https://itsfoss.com/install-linux-on-intel-nuc/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Install Linux on Intel NUC
======
The previous week, I got myself an [Intel NUC][1]. Though it is a tiny device, it is equivalent to a full-fledged desktop CPU. Most of the [Linux-based mini PCs][2] are actually built on top of the Intel NUC devices.
I got the barebone NUC with 8th generation Core i3 processor. Barebone means that the device has no RAM, no hard disk and obviously, no operating system. I added an [8GB RAM from Crucial][3] (around $33) and a [240 GB Western Digital SSD][4] (around $45).
Altogether, I had a desktop PC ready in under $400. I already have a screen and keyboard-mouse pair so I am not counting them in the expense.
![A brand new Intel NUC NUC8i3BEH at my desk with Raspberry Pi 4 lurking behind][5]
The main reason why I got Intel NUC is that I want to test and review various Linux distributions on real hardware. I have a [Raspberry Pi 4][6] which works as an entry-level desktop but its an [ARM][7] device and thus there are only a handful of Linux distributions available for Raspberry Pi.
_The Amazon links in the article are affiliate links. Please read our [affiliate policy][8]._
### Installing Linux on Intel NUC
I started with Ubuntu 18.04 LTS version because thats what I had available at the moment. You can follow this tutorial for other distributions as well. The steps should remain the same at least till the partition step which is the most important one in the entire procedure.
#### Step 1: Create a live Linux USB
Download Ubuntu 18.04 from its website. Use another computer to [create a live Ubuntu USB][9]. You can use a tool like [Rufus][10] or [Etcher][11]. On Ubuntu, you can use the default Startup Disk Creator tool.
#### Step 2: Make sure the boot order is correct
Insert your USB and power on the NUC. As soon as you see the Intel NUC written on the screen, press F2 to go to BIOS settings.
![BIOS Settings in Intel NUC][12]
In here, just make sure that boot order is set to boot from USB first. If not, change the boot order.
If you had to make any changes, press F10 to save and exit. Else, use Esc to exit the BIOS.
#### Step 3: Making the correct partition to install Linux
Now when it boots again, youll see the familiar Grub screen that allows you to try Ubuntu live or install it. Choose to install it.
[][13]
Suggested read  3 Ways to Check Linux Kernel Version in Command Line
First few installation steps are simple. You choose the keyboard layout, and the network connection (if any) and other simple steps.
![Choose the keyboard layout while installing Ubuntu Linux][14]
You may go with the normal installation that has a handful of useful applications installed by default.
![][15]
The interesting screen comes next. You have two options:
* **Erase disk and install Ubuntu**: Simplest option that will install Ubuntu on the entire disk. If you want to use only one operating system on the Intel NUC, choose this option and Ubuntu will take care of the rest.
* **Something Else**: This is the advanced option if you want to take control of things. In my case, I want to install multiple Linux distribution on the same SSD. So I am opting for this advanced option.
![][16]
_**If you opt for “Erase disk and install Ubuntu”, click continue and go to the step 4.**_
If you are going with the advanced option, follow the rest of the step 3.
Select the SSD disk and click on New Partition Table.
![][17]
It will show you a warning. Just hit Continue.
![][18]
Now youll see a free space of the size of your SSD disk. My idea is to create an EFI System Partition for the EFI boot loader, a root partition and a home partition. I am not creating a [swap partition][19]. Ubuntu creates a swap file on its own and if the need be, I can extend the swap by creating additional swap files.
Ill leave almost 200 GB of free space on the disk so that I could install other Linux distributions here. You can utilize all of it for your home partitions. Keeping separate root and home partitions help you when you want to save reinstall the system
Select the free space and click on the plus sign to add a partition.
![][20]
Usually 100 MB is sufficient for the EFI but some distributions may need more space so I am going with 500 MB of EFI partition.
![][21]
Next, I am using 20 GB of root space. If you are going to use only one distributions, you can increase it to 40 GB easily.
Root is where the system files are kept. Your program cache and installed applications keep some files under the root directory. I recommend [reading about the Linux filesystem hierarchy][22] to get more knowledge on this topic.
[][23]
Suggested read  Share Folders On Local Network Between Ubuntu And Windows
Provide the size, choose Ext4 file system and use / as the mount point.
![][24]
The next is to create a home partition. Again, if you want to use only one Linux distribution, go for the remaining free space. Else, choose a suitable disk space for the Home partition.
Home is where your personal documents, pictures, music, download and other files are stored.
![][25]
Now that you have created EFI, root and home partitions, you are ready to install Ubuntu Linux. Hit the Install Now button.
![][26]
It will give you a warning about the new changes being written to the disk. Hit continue.
![][27]
#### Step 4: Installing Ubuntu Linux
Things are pretty straightforward from here onward. Choose your time zone right now or change it later.
![][28]
On the next screen, choose a username, hostname and the password.
![][29]
Its a wait an watch game for next 7-8 minutes.
![][30]
Once the installation is over, youll be prompted for a restart.
![][31]
When you restart, you should remove the live USB otherwise youll boot into the installation media again.
Thats all you need to do to install Linux on an Intel NUC device. Quite frankly, you can use the same procedure on any other system.
**Intel NUC and Linux: how do you use it?**
I am loving the Intel NUC. It doesnt take space on the desk and yet it is powerful enough to replace the regular bulky desktop CPU. You can easily upgrade it to 32GB of RAM. You can install two SSD on it. Altogether, it provides some scope of configuration and upgrade.
If you are looking to buy a desktop computer, I highly recommend [Intel NUC][1] mini PC. If you are not comfortable installing the OS on your own, you can [buy one of the Linux-based mini PCs][2].
Do you own an Intel NUC? Hows your experience with it? Do you have any tips to share it with us? Do leave a comment below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-linux-on-intel-nuc/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (Intel NUC)
[2]: https://itsfoss.com/linux-based-mini-pc/
[3]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB RAM from Crucial)
[4]: https://www.amazon.com/Western-Digital-240GB-Internal-WDS240G1G0B/dp/B01M9B2VB7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M9B2VB7 (240 GB Western Digital SSD)
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/intel-nuc.jpg?resize=800%2C600&ssl=1
[6]: https://itsfoss.com/raspberry-pi-4/
[7]: https://en.wikipedia.org/wiki/ARM_architecture
[8]: https://itsfoss.com/affiliate-policy/
[9]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/
[10]: https://rufus.ie/
[11]: https://www.balena.io/etcher/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/boot-screen-nuc.jpg?ssl=1
[13]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-1_tutorial.jpg?ssl=1
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-2_tutorial.jpg?ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-3_tutorial.jpg?ssl=1
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-4_tutorial.jpg?ssl=1
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-5_tutorial.jpg?ssl=1
[19]: https://itsfoss.com/swap-size/
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-6_tutorial.jpg?ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-7_tutorial.jpg?ssl=1
[22]: https://linuxhandbook.com/linux-directory-structure/
[23]: https://itsfoss.com/share-folders-local-network-ubuntu-windows/
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-8_tutorial.jpg?ssl=1
[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-9_tutorial.jpg?ssl=1
[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-10_tutorial.jpg?ssl=1
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-11_tutorial.jpg?ssl=1
[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-12_tutorial.jpg?ssl=1
[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1
[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1
[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1

View File

@ -1,222 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots)
[#]: via: (https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/)
[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/)
Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots
======
Within a year of releasing **Manjaro 18.0** (**Illyria**), the team has come out with their next big release with **Manjaro 18.1**, codenamed “**Juhraya**“. The team also have come up with an official announcement saying that Juhraya comes packed with a lot of improvements and bug fixes.
### New Features in Manjaro 18.1
Some of the new features and enhancements in Manjaro 18.1 are listed below:
* Option to choose between LibreOffice or Free Office
* New Matcha theme for Xfce edition
* Redesigned messaging system in KDE edition
* Support for Snap and FlatPak packages using “bhau” tool
### Minimum System Requirements for Manjaro 18.1
* 1 GB RAM
* One GHz Processor
* Around 30 GB Hard disk space
* Internet Connection
* Bootable Media (USB/DVD)
### Step by Step Guide to Install Manjaro 18.1 (KDE Edition)
To start installing Manjaro 18.1 (KDE Edition) in your system, please follow the steps outline below:
### Step 1) Download Manjaro 18.1 ISO
Before installing, you need to download the latest copy of Manjaro 18.1 from its official download page located **[here][1]**. Since we are seeing about the KDE version, we chose to install the KDE version. But the installation process is the same for all desktop environments including Xfce, KDE and Gnome editions.
### Step 2) Create a USB Bootable Disk
Once you have successfully downloaded the ISO file from Manjaro downloads page, it is time to create an USB disk. Copy the downloaded ISO file in a USB disk and create a bootable disk. Make sure to change your boot settings to boot using a USB and restart your system
### Step 3) Manjaro Live Installation Environment
When the system restarts, it will automatically detect the USB drive and starts booting into the Manjaro Live Installation Screen.
[![Boot-Manjaro-18-1-kde-installation][2]][3]
Next use the arrow keys to choose “**Boot: Manjaro x86_64 kde**” and hit enter to launch the Manjaro Installer.
### Step 4) Choose Launch Installer
Next the Manjaro installer will be launched and If you are connected to the internet, Manjaro will automatically detect your location and time zone. Click “**Launch Installer**” start installing Manjaro 18.1 KDE edition in your system.
[![Choose-Launch-Installaer-Manjaro18-1-kde][2]][4]
### Step 5) Choose Your Language
Next the installer will take you to choose your preferred language.
[![Choose-Language-Manjaro18-1-Kde-Installation][2]][5]
Select your desired language and click “Next”
### Step 6) Choose Your time zone and region
In the next screen, select your desired time zone and region and click “Next” to continue
[![Select-Location-During-Manjaro18-1-KDE-Installation][2]][6]
### Step 7) Choose Keyboard layout
In the next screen, select your preferred keyboard layout and click “Next” to continue.
[![Select-Keyboard-Layout-Manjaro18-1-kde-installation][2]][7]
### Step 8) Choose Partition Type
This is a very critical step in the installation process. It will allow you to choose between:
* Erase Disk
* Manual Partitioning
* Install Alongside
* Replace a Partition
If you are installing Manjaro 18.1 in a VM (Virtual Machine), then you wont be able to see the last 2 options.
If you are new to Manjaro Linux then I would suggest you should go with first option (**Erase Disk**), it will automatically create required partitions for you. If you want to create custom partitions then choose the second option “**Manual Partitioning**“, as its name suggests it will allow us to create our own custom partitions.
In this tutorial I will be creating custom partitions by selecting “Manual Partitioning” option,
[![Manual-Partition-Manjaro18-1-KDE][2]][8]
Choose the second option and click “Next” to continue.
As we can see i have 40 GB hard disk, so I will create following partitions on it,
* /boot         2GB (ext4 file system)
* /                 10 GB (ext4 file system)
* /home       22 GB (ext4 file system)
* /opt           4 GB (ext4 file system)
* Swap         2 GB
When we click on Next in above window, we will get the following screen, choose to create a **new partition table**,
[![Create-Partition-Table-Manjaro18-1-Installation][2]][9]
Click on Ok,
Now choose the free space and then click on **create** to setup the first partition as /boot of size 2 GB,
[![boot-partition-manjaro-18-1-installation][2]][10]
Click on OK to proceed with further, in the next window choose again free space and then click on create  to setup second partition as / of size 10 GB,
[![slash-root-partition-manjaro18-1-installation][2]][11]
Similarly create next partition as /home of size 22 GB,
[![home-partition-manjaro18-1-installation][2]][12]
As of now we have created three partitions as primary, now create next partition as extended,
[![Extended-Partition-Manjaro18-1-installation][2]][13]
Click on OK to proceed further,
Create /opt and Swap partition of size 5 GB and 2 GB respectively as logical partitions
[![opt-partition-manjaro-18-1-installation][2]][14]
[![swap-partition-manjaro18-1-installation][2]][15]
Once are done with all the partitions creation, click on Next
[![choose-next-after-partition-creation][2]][16]
### Step 9) Provide User Information
In the next screen, you need to provide the user information including your name, username, password, computer name etc.
[![User-creation-details-manjaro18-1-installation][2]][17]
Click “Next” to continue with the installation after providing all the information.
In the next screen you will be prompted to choose the office suite, so make a choice that suits to your installation,
[![Office-Suite-Selection-Manjaro18-1][2]][18]
Click on Next to proceed further,
### Step 10) Summary Information
Before the actual installation is done, the installer will show you all the details youve chosen including the language, time zone, keyboard layout and partitioning information etc. Click “**Install**” to proceed with the installation process.
[![Summary-manjaro18-1-installation][2]][19]
### Step 11) Install Manjaro 18.1 KDE Edition
Now the actual installation process begins and once it gets completed, restart the system to login to Manjaro 18.1 KDE edition ,
[![Manjaro18-1-Installation-Progress][2]][20]
[![Restart-Manjaro-18-1-after-installation][2]][21]
### Step:12) Login after successful installation
After the restart we will get the following login screen, use the users credentials that we created during the installation
[![Login-screen-after-manjaro-18-1-installation][2]][22]
Click on Login,
[![KDE-Desktop-Screen-Manjaro-18-1][2]][23]
Thats it! Youve successfully installed Manjaro 18.1 KDE edition in your system and explore all the exciting features. Please post your feedback and suggestions in the comments section below.
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/
作者:[Pradeep Kumar][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lujun9972
[1]: https://manjaro.org/download/official/kde/
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Boot-Manjaro-18-1-kde-installation.jpg
[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Launch-Installaer-Manjaro18-1-kde.jpg
[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Language-Manjaro18-1-Kde-Installation.jpg
[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Location-During-Manjaro18-1-KDE-Installation.jpg
[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Keyboard-Layout-Manjaro18-1-kde-installation.jpg
[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manual-Partition-Manjaro18-1-KDE.jpg
[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Create-Partition-Table-Manjaro18-1-Installation.jpg
[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/boot-partition-manjaro-18-1-installation.jpg
[11]: https://www.linuxtechi.com/wp-content/uploads/2019/09/slash-root-partition-manjaro18-1-installation.jpg
[12]: https://www.linuxtechi.com/wp-content/uploads/2019/09/home-partition-manjaro18-1-installation.jpg
[13]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Extended-Partition-Manjaro18-1-installation.jpg
[14]: https://www.linuxtechi.com/wp-content/uploads/2019/09/opt-partition-manjaro-18-1-installation.jpg
[15]: https://www.linuxtechi.com/wp-content/uploads/2019/09/swap-partition-manjaro18-1-installation.jpg
[16]: https://www.linuxtechi.com/wp-content/uploads/2019/09/choose-next-after-partition-creation.jpg
[17]: https://www.linuxtechi.com/wp-content/uploads/2019/09/User-creation-details-manjaro18-1-installation.jpg
[18]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Office-Suite-Selection-Manjaro18-1.jpg
[19]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Summary-manjaro18-1-installation.jpg
[20]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manjaro18-1-Installation-Progress.jpg
[21]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Restart-Manjaro-18-1-after-installation.jpg
[22]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Login-screen-after-manjaro-18-1-installation.jpg
[23]: https://www.linuxtechi.com/wp-content/uploads/2019/09/KDE-Desktop-Screen-Manjaro-18-1.jpg

View File

@ -1,81 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Use sshuttle to build a poor mans VPN)
[#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/)
[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/)
Use sshuttle to build a poor mans VPN
======
![][1]
Nowadays, business networks often use a VPN (virtual private network) for [secure communications with workers][2]. However, the protocols used can sometimes make performance slow. If you can reach reach a host on the remote network with SSH, you could set up port forwarding. But this can be painful, especially if you need to work with many hosts on that network. Enter **sshuttle** — which lets you set up a quick and dirty VPN with just SSH access. Read on for more information on how to use it.
The sshuttle application was designed for exactly the kind of scenario described above. The only requirement on the remote side is that the host must have Python available. This is because sshuttle constructs and runs some Python source code to help transmit data.
### Installing sshuttle
The sshuttle application is packaged in the official repositories, so its easy to install. Open a terminal and use the following command [with sudo][3]:
```
$ sudo dnf install sshuttle
```
Once installed, you may find the manual page interesting:
```
$ man sshuttle
```
### Setting up the VPN
The simplest case is just to forward all traffic to the remote network. This isnt necessarily a crazy idea, especially if youre not on a trusted local network like your own home. Use the _-r_ switch with the SSH username and the remote host name:
```
$ sshuttle -r username@remotehost 0.0.0.0/0
```
However, you may want to restrict the VPN to specific subnets rather than all network traffic. (A complete discussion of subnets is outside the scope of this article, but you can read more [here on Wikipedia][4].) Lets say your office internally uses the reserved Class A subnet 10.0.0.0 and the reserved Class B subnet 172.16.0.0. The command above becomes:
```
$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16
```
This works great for working with hosts on the remote network by IP address. But what if your office is a large network with lots of hosts? Names are probably much more convenient — maybe even required. Never fear, sshuttle can also forward DNS queries to the office with the _dns_ switch:
```
$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16
```
To run sshuttle like a daemon, add the _-D_ switch. This also will send log information to the systemd journal via its syslog compatibility.
Depending on the capabilities of your system and the remote system, you can use sshuttle for an IPv6 based VPN. You can also set up configuration files and integrate it with your system startup if desired. If you want to read even more about sshuttle and how it works, [check out the official documentation][5]. For a look at the code, [head over to the GitHub page][6].
* * *
_Photo by _[_Kurt Cotoaga_][7]_ on _[_Unsplash_][8]_._
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/
作者:[Paul W. Frields][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/pfrields/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/sshuttle-816x345.jpg
[2]: https://en.wikipedia.org/wiki/Virtual_private_network
[3]: https://fedoramagazine.org/howto-use-sudo/
[4]: https://en.wikipedia.org/wiki/Subnetwork
[5]: https://sshuttle.readthedocs.io/en/stable/index.html
[6]: https://github.com/sshuttle/sshuttle
[7]: https://unsplash.com/@kydroon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[8]: https://unsplash.com/s/photos/shuttle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText

View File

@ -0,0 +1,156 @@
[#]: collector: (lujun9972)
[#]: translator: (laingke)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What is a Java constructor?)
[#]: via: (https://opensource.com/article/19/6/what-java-constructor)
[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/ashleykoree)
Java 构造器是什么?
======
构造器是编程的强大组件。使用它们来释放 Java 的全部潜力。
![][1]
在开源、跨平台编程领域Java 无疑是无可争议的重量级语言。尽管有许多[伟大的][2][跨平台][2][框架][3],但很少有像 [Java][4] 那样统一和直接的。
当然Java 还是一种非常复杂的语言具有自己的微妙之处和约定。Java 中与**构造器**有关的最常见问题之一是:它们是什么,它们的作用是什么?
简而言之:构造器是在 Java 中创建新**对象**时执行的操作。当 Java 应用程序创建你编写的类的实例时,它将检查构造器。如果存在构造器,则 Java 在创建实例时将运行构造器中的代码。这几句话中包含了大量的技术术语,但是当你看到它的实际应用时就会更加清楚,所以请确保你已经[安装了 Java][5] 并准备好进行演示。
### 没有使用构造器的开发日常
如果你正在编写 Java 代码那么你已经在使用构造器了即使你可能不知道它。Java 中的所有类都有一个构造器因为即使你没有创建构造器Java 也会在编译代码时为你完成。但是,为了进行演示,请忽略 Java 提供的隐藏构造器(因为默认构造器不添加任何额外的功能),并观察没有显式构造器的情况。
假设你正在编写一个简单的 Java 掷骰子应用程序,因为你想为游戏生成一个伪随机数。
首先,你可以创建 dice 类来表示一个骰子。知道你玩了很久[《龙与地下城》][6],你决定创建一个 20 面的骰子。在这个示例代码中,变量 **dice** 是整数 20表示可能的最大掷骰数(一个 20 边骰子的掷骰数不能超过 20)。变量 **roll** 是最终的随机数的占位符,**rand** 用作随机数种子。
```
import java.util.Random;
public class DiceRoller {
private int dice = 20;
private int roll;
private [Random][7] rand = new [Random][7]();
```
接下来,在 **DiceRoller** 类中创建一个函数,以执行计算机模拟模子滚动所必须采取的步骤:从 **rand** 中获取一个整数并将其分配给 **roll**变量,考虑到 Java 从 0 开始计数但 20 面的骰子没有 0 值的情况,**roll** 再加 1 ,然后打印结果。
```
public void Roller() {
roll = rand.nextInt(dice);
roll += 1;
[System][8].out.println (roll);
}
```
最后,产生 **DiceRoller** 类的实例并调用其关键函数 **Roller**
```
// main loop
public static void main ([String][9][] args) {
[System][8].out.printf("You rolled a ");
DiceRoller App = new DiceRoller();
App.Roller();
}
}
```
只要你安装了 Java 开发环境(如 [OpenJDK][10]),你就可以在终端上运行你的应用程序:
```
$ java dice.java
You rolled a 12
```
在本例中,没有显式构造器。这是一个非常有效和合法的 Java 应用程序,但是它有一点局限性。例如,如果你把游戏《龙与地下城》放在一边,晚上去玩一些《快艇骰子》,你将需要六面骰子。在这个简单的例子中,更改代码不会有太多的麻烦,但是在复杂的代码中这不是一个现实的选择。解决这个问题的一种方法是使用构造器。
### 构造函数的作用
这个示例项目中的 **DiceRoller** 类表示一个虚拟骰子工厂:当它被调用时,它创建一个虚拟骰子,然后进行“滚动”。然而,通过编写一个自定义构造器,你可以让掷骰子的应用程序询问你希望模拟哪种类型的骰子。
大部分代码都是一样的,除了构造器接受一个表示边的数字参数。这个数字还不存在,但稍后将创建它。
```
import java.util.Random;
public class DiceRoller {
private int dice;
private int roll;
private [Random][7] rand = new [Random][7]();
// 构造器
public DiceRoller(int sides) {
dice = sides;
}
```
模拟滚动的功能保持不变:
```
public void Roller() {
roll = rand.nextInt(dice);
roll += 1;
[System][8].out.println (roll);
}
```
代码的主要部分提供运行应用程序时提供的任何参数。这的确会是一个复杂的应用程序,你需要仔细解析参数并检查意外结果,但对于这个例子,唯一的预防措施是将参数字符串转换成整数类型。
```
public static void main ([String][9][] args) {
[System][8].out.printf("You rolled a ");
DiceRoller App = new DiceRoller( [Integer][11].parseInt(args[0]) );
App.Roller();
}
}
```
启动这个应用程序,并提供你希望骰子具有的面数:
```
$ java dice.java 20
You rolled a 10
$ java dice.java 6
You rolled a 2
$ java dice.java 100
You rolled a 44
```
构造器已接受你的输入,因此在创建类实例时,会将 **sides** 变量设置为用户指定的任何数字。
构造器是编程的功能强大的组件。练习用它们来解开了 Java 的全部潜力。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/6/what-java-constructor
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[laingke](https://github.com/laingke)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth/users/ashleykoree
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag
[2]: https://opensource.com/resources/python
[3]: https://opensource.com/article/17/4/pyqt-versus-wxpython
[4]: https://opensource.com/resources/java
[5]: https://openjdk.java.net/install/index.html
[6]: https://opensource.com/article/19/5/free-rpg-day
[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random
[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
[10]: https://openjdk.java.net/
[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer

View File

@ -0,0 +1,263 @@
[#]: collector: (lujun9972)
[#]: translator: (lnrCoder)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu)
[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/)
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
如何在 Ubuntu 上安装和配置 PostgreSQL
======
_**本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。**_
[PostgreSQL][1] (又名 Postgres) 是一个功能强大的,免费的开源关系型数据库管理系统 ([RDBMS][2]) 其 在可靠性、稳定性、性能方面获得了业内极高的声誉 。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。
如果你喜欢简单易用的 SQL 数据库管理器,那么 PostgreSQL 将是一个正确的选择。PostgreSQL 对标准的 SQL 兼容的同时提供了额外的附加特性,同时还可以被用户大量扩展,用户可以添加数据类型、函数并执行更多的操作。
之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL以便你随时可以使用它来满足你的任何需求。
![][5]
### 在 Ubuntu 上安装 PostgreSQL
PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其他开发工具一样,它可能不是最新版本。
首先在终端中使用 [apt 命令][7] 检查 [Ubuntu 存储库][6] 中可用的 PostgreSQL 版本:
```
apt show postgresql
```
在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10 (10+190 表示版本 10) 而 PostgreSQL 版本 11 已经发布。
```
Package: postgresql
Version: 10+190
Priority: optional
Section: database
Source: postgresql-common (190)
Origin: Ubuntu
```
根据这些信息,你可以自主决定是安装 Ubuntu 提供的版本还是还是获取 PostgreSQL 的最新发行版。
我将向你介绍这两种方法:
#### 方法一:通过 Ubuntu 存储库安装 PostgreSQL
在终端中,使用以下命令安装 PostgreSQL
```
sudo apt update
sudo apt install postgresql postgresql-contrib
```
根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。 说到这一点 ,随时检查 [Ubuntu 中的各种网络带宽][8]。
什么是 postgresql-contrib?
postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。
推荐阅读 [解决 gvfsd-smb-browser 在 Ubuntu 16.04 中占用 100 CPU][9]
#### 方法二:在 Ubuntu 中安装最新版本的 PostgreSQL 11
要安装 PostgreSQL 11, 你需要在 sources.list 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。
不用担心,这并不复杂。 只需按照以下步骤。
首先添加 GPG 密钥:
```
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
```
现在,使用以下命令添加存储库。如果你使用的是 Linux Mint则必须手动替换你的 Mint 所基于的 Ubuntu 版本号
```
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
```
现在一切就绪。使用以下命令安装 PostgreSQL
```
sudo apt update
sudo apt install postgresql postgresql-contrib
```
PostgreSQL GUI 应用程序
你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序 (pgAdmin)
_sudo apt install pgadmin4_
### PostgreSQL 配置
你可以通过执行以下命令来检查 **PostgreSQL** 是否正在运行:
```
service postgresql status
```
通过 **service** 命令,你可以 **启动**, **关闭****重启** **postgresql**。输入 **service postgresql** 并按 **回车** 将列出所有选项。现在,登录用户。
默认情况下PostgreSQL 会创建一个拥有所权限的特殊用户 postgres 。要实际使用 PostgreSQL你必须先登录该账户
```
sudo su postgres
```
你的提示应更改为类似于以下的内容:
```
postgres@ubuntu-VirtualBox:/home/ubuntu$
```
现在,使用 **psql** 来启动 **PostgreSQL Shell**
```
psql
```
你应该会收到如下提示:
```
postgress=#
```
你可以输入 **\q** 以**退出**,输入 **\?** 获取**帮助**。
要查看现有的所有表,输入如下命令:
```
\l
```
输出内容类似于下图所示 (单击 **q** 键退出该视图)
![PostgreSQL Tables][10]
使用 **\du** 命令,你可以查看 **PostgreSQL 用户**
![PostgreSQLUsers][11]
你可以使用以下命令更改任何用户(包括 postgres的密码
```
ALTER USER postgres WITH PASSWORD 'my_password';
```
**注意:** _将 **postgres** 替换为用户名 **my_password** 替换为所需要的密码。_ 另外,不要忘记每条命令后面的 **;** (分号)。
建议你另外创建一个用户(不建议使用默认的 **postgres** 用户)。为此,请使用一下命令:
```
CREATE USER my_user WITH PASSWORD 'my_password';
```
运行 **\du**,你将看到该用户,但是,**my_user** 用户没有任何的属性。来让我们将它添加到**超级用户**
```
ALTER USER my_user WITH SUPERUSER;
```
你可以使用以下命令 **删除用户**
```
DROP USER my_user;
```
要使用其他用户登录,使用 **\q** 命令退出,然后使用以下命令登录:
```
psql -U my_user
```
你可以使用 **-d** 参数直接连接数据库:
```
psql -U my_user -d my_db
```
你可以使用其他已存在的用户调用 PostgreSQL。例如我使用 **ubuntu**。要登录,从终端执行以下命名:
```
psql -U ubuntu -d postgres
```
**注意:** _你必须指定一个数据库默认情况下它将尝试将你连接到与登录的用户名相同的数据库。_
如果遇到如下错误:
```
psql: FATAL: Peer authentication failed for user "my_user"
```
确保以正确的用户身份登录,并使用管理员权限编辑 **/etc/postgresql/11/main/pg_hba.conf**
```
sudo vim /etc/postgresql/11/main/pg_hba.conf
```
**注意:** _用你的版本替换 **11** (例如 **10**)._
对如下所示的一行进行替换:
```
local all postgres peer
```
替换为:
```
local all postgres md5
```
然后重启 **PostgreSQL**
```
sudo service postgresql restart
```
使用 **PostgreSQL** 与使用其他 **SQL** 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册 (**man psql**) 和 [文档][13] 也非常有用。
建议阅读 [如何][14] 在 Ubuntu 中与 Dropbox 共享和同步任何文件夹。
**总结**
阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL你应该阅读 [基本的 SQL 命令][15]
[基本的 SQL 命令][15]
如果您有任何问题或疑惑,请随时在评论部分提出。
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-postgresql-ubuntu/
作者:[Sergiu][a]
选题:[lujun9972][b]
译者:[lnrCoder](https://github.com/lnrCoder)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sergiu/
[b]: https://github.com/lujun9972
[1]: https://www.postgresql.org/
[2]: https://www.codecademy.com/articles/what-is-rdbms-sql
[3]: https://www.apple.com/in/macos/server/
[4]: https://itsfoss.com/install-mysql-ubuntu/
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1
[6]: https://itsfoss.com/ubuntu-repositories/
[7]: https://itsfoss.com/apt-command-guide/
[8]: https://itsfoss.com/network-speed-monitor-linux/
[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1
[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546
[13]: https://www.postgresql.org/docs/manuals/
[14]: https://itsfoss.com/sync-any-folder-with-dropbox/
[15]: https://itsfoss.com/basic-sql-commands/

View File

@ -0,0 +1,192 @@
[#]: collector: (lujun9972)
[#]: translator: (amwps290)
[#]: reviewer: ()
[#]: publisher: ()
[#]: url: ()
[#]: subject: "How to Install Linux on Intel NUC"
[#]: via: "https://itsfoss.com/install-linux-on-intel-nuc/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
在 Intel NUC 上安装 Linux
======
在上一周,我给我自己买了一台 [InteL NUC][1]。虽然它是如此之小,但它与成熟的桌面型电脑差别甚小。实际上,大部分的[基于 Linux 的微型 PC][2] 都是基于 Intel NUC 构建的。
我买了第 8 代 Core i3 处理器的“准系统” NUC。 准系统意味着该设备没有 RAM没有硬盘显然也没有操作系统。我加了一个 [Crucial 的 8 GB 的内存条][3](大约 33 美元)和一个 [240GB 的西数的固态硬盘][4](大约 45 美元)。
现在,我已经有了一台不到 400 美元的电脑。因为我已经有了一个电脑屏幕和键鼠套装,所以我没有把它们计算在内。
![A brand new Intel NUC NUC8i3BEH at my desk with Raspberry Pi 4 lurking behind][5]
我买这个 Intel NUC 的主要原因就是我想在实体机上测试各种各样的 Linux 发行版。我已经有一个 [Raspberry Pi 4][6] 设备作为一个入门级的桌面系统,但它是一个 [ARM][7] 设备,因此,只有少数 Linux 发行版可用于 Raspberry Pi 上。
这个文章里的亚马逊链接是会员连接。请参阅我们的[会员政策][8]。
### 在 NUC 上安装 Linux
现在我准备安装 Ubuntu 18.04 长期支持版,因为我现在就有这个系统的安装文件。你也可以按照这个教程安装其他的发行版。在最重要的分区之前,前边的步骤都大致相同。
### 第一步:创建一个 USB 启动盘
你可以在 Ubuntu 官网下载它的安装文件。使用另一个电脑去[创建一个 USB 启动盘][9]。你可以使用像 [Rufus][10] 和 [Etcher][11] 这样的软件。在 Ubuntu上您可以使用默认的 Startup Disk Creator 工具。
### 第二步:确认启动顺序的正确性
将你的 USB 启动盘插入到你的电脑并开机。一旦你看到 “Intel NUC” 字样出现在你的屏幕上,快速的按下 F2 进入到 BIOS 设置中。
![BIOS Settings in Intel NUC][12]
在这里,仅仅确认你的第一启动项是你的 USB 设备 。如果不是,切换启动顺序。
如果你修改了一些选项,按 F10 保存退出,否则直接按下 ESC 退出 BIOS 设置。
#### 第三步:正确分区,安装 Linux
现在当机器重启的时候,你就可以看到熟悉的 Grub 界面,可以让你试用或者安装 Ubuntu。现在我们选择安装它。
[][13]
建议你看一下如何在命令行中查看 Linux 内核版本。
开始的几个安装步骤非常简单,选择键盘的布局,是否连接网络还有一些其他简单的设置。
![Choose the keyboard layout while installing Ubuntu Linux][14]
您可能会使用常规安装,默认情况下会安装一些有用的应用程序。
![][15]
接下来的内容非常有趣。 您有两种选择:
* **擦除磁盘并安装 Ubuntu**:最简单的选项,它将在整个磁盘上安装 Ubuntu。 如果您只想在 Intel NUC 上使用一个操作系统请选择此选项Ubuntu 将负责剩余的工作。
* **其他选项**:这是一个控制所有事的高级选项。 就我而言,我想在同一 SSD 上安装多个 Linux 发行版。 因此,我选择了此高级选项。
![][16]
_**如果你选择了擦除并安装 Ubuntu点击继续直接跳到第四步**_
如果你选择了高级选项,请按照下面的第三步进行操作。
选择固态硬盘,然后点击新的分区表
![][17]
它会给你显示一个警告。直接点击继续。
![][18]
现在你就可以看到你 SSD 磁盘里的空闲空间。我的想法是为 EFI bootloader 创建一个 EFI 系统分区。一个根root分区一个主目录home分区。这里我并没有创建[交换分区][19]。Ubuntu 会根据自己的需要来创建交换分区。我也可以通过创建新的交换文件来扩展交换分区。
我将在磁盘上保留近 200 GB 的可用空间,以便可以在此处安装其他 Linux 发行版。 您可以将其全部用于主目录分区。 保留单独的根分区和主分区可以在您需要保存时帮助您重新安装系统
选择可用空间,然后单击加号以添加分区。
![][20]
一般来说100MB 足够 EFI 的使用,但是某些发行版可能需要更多空间,因此我要使用 500MB 的 EFI 分区。
![][21]
接下来,我将使用 20GB 的根分区。 如果你只使用一个发行版,则可以随意地将其增加到 40GB。
Root 目录是系统文件存放的地方。你的程序缓存和你安装的程序将会有一些文件放在这个目录下边。我建议你可以阅读一下[ Linux 文件系统层次结构][22]来了解更多相关内容。
[][23]
建议你阅读一下如何在 Ubuntu 和 Windows 之间共享文件
填入分区的大小,选择 Ext4 文件系统,选择 / 作为挂载点。
![][24]
接下来是创建一个主目录分区,我再说一下,如果你仅仅想使用一个 Linux 发行版。那就把剩余的空间都使用完吧。为主目录分区选择一个合适的大小。
主目录是你个人的文件,比如文档,图片,音乐,下载和一些其他的文件存储的地方。
![][25]
既然你创建好了 EFI 分区,根分区,主目录分区,那你就可以点击安装按钮安装系统了。
![][26]
他将会提示你新的改变将会被写入到磁盘,点击继续。
![][27]
#### 第四步:安装 Ubuntu
事情到了这就非常明了了。现在选择你的分区或者以后选择也可以。
![][28]
接下来,输入你的用户名,主机名以及密码。
![][29]
看 7-8 分钟的动画就可以安装完成了。
![][30]
一旦安装完成,你就可以重新启动了。
![][31]
当你重启的时候,你必须要移除你的 USB 设备,否则你将会再次进入安装系统的界面。
这就是在 Intel NUC 设备上安装 Linux 所需要做的一切。 坦白说,您可以在其他任何系统上使用相同的过程。
**Intel NUC 和 Linux 在一起:如何使用它?**
我非常喜欢 Intel NUC。它不占用太多的桌面空间而且有足够的能力去取代传统的桌面型电脑。你可以将它的内存升级到 32GB。你也可以安装两个 SSD 硬盘。总之,它提供了一些配置和升级范围。
如果你想购买一个桌面型的电脑,我非常推荐你购买使用 [Intel NUC][1] 迷你主机。如果你不想自己安装系统,那么你可以购买一个[基于 Linux 的已经安装好的系统迷你主机][2]。
你是否已经有了一个 Intel NUC有一些什么相关的经验你有什么相关的意见与我们分享吗可以在下面评论。
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-linux-on-intel-nuc/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[amwps290](https://github.com/amwps290)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW "Intel NUC"
[2]: https://itsfoss.com/linux-based-mini-pc/
[3]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 "8GB RAM from Crucial"
[4]: https://www.amazon.com/Western-Digital-240GB-Internal-WDS240G1G0B/dp/B01M9B2VB7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M9B2VB7 "240 GB Western Digital SSD"
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/intel-nuc.jpg?resize=800%2C600&ssl=1
[6]: https://itsfoss.com/raspberry-pi-4/
[7]: https://en.wikipedia.org/wiki/ARM_architecture
[8]: https://itsfoss.com/affiliate-policy/
[9]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/
[10]: https://rufus.ie/
[11]: https://www.balena.io/etcher/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/boot-screen-nuc.jpg?ssl=1
[13]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-1_tutorial.jpg?ssl=1
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-2_tutorial.jpg?ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-3_tutorial.jpg?ssl=1
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-4_tutorial.jpg?ssl=1
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-5_tutorial.jpg?ssl=1
[19]: https://itsfoss.com/swap-size/
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-6_tutorial.jpg?ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-7_tutorial.jpg?ssl=1
[22]: https://linuxhandbook.com/linux-directory-structure/
[23]: https://itsfoss.com/share-folders-local-network-ubuntu-windows/
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-8_tutorial.jpg?ssl=1
[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-9_tutorial.jpg?ssl=1
[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-10_tutorial.jpg?ssl=1
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-11_tutorial.jpg?ssl=1
[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-12_tutorial.jpg?ssl=1
[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1
[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1
[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1

View File

@ -0,0 +1,218 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots)
[#]: via: (https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/)
[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/)
Manjaro 18.1KDE安装图解
======
在 Manjaro 18.0Illyria发布一年之际该团队发布了他们的下一个重要版本即 Manjaro 18.1,代号为 “Juhraya”。该团队还发布了一份官方声明称 Juhraya 包含了许多改进和错误修复。
### Manjaro 18.1 中的新功能
以下列出了 Manjaro 18.1 中的一些新功能和增强功能:
* 可以在 LibreOffice 或 Free Office 之间选择
* Xfce 版的新 Matcha 主题
* 在 KDE 版本中重新设计了消息传递系统
* 使用 bhau 工具支持 Snap 和 FlatPak 软件包
### 最小系统需求
* 1 GB RAM
* 1 GHz 处理器
* 大约 30 GB 硬盘空间
* 互联网连接
* 启动介质USB/DVD
### 安装 Manjaro 18.1KDE 版)的分步指南
要在系统中开始安装 Manjaro 18.1KDE 版),请遵循以下步骤:
#### 步骤 1) 下载 Manjaro 18.1 ISO
在安装之前,你需要从位于 [这里] [1] 的官方下载页面下载 Manjaro 18.1 的最新副本。由于我们这里介绍的是 KDE 版本,因此我们选择 KDE 版本。但是对于所有桌面环境(包括 Xfce、KDE 和 Gnome 版本),安装过程都是相同的。
#### 步骤 2) 创建 USB 启动盘
从 Manjaro 下载页面成功下载 ISO 文件后,就可以创建 USB 磁盘了。将下载的 ISO 文件复制到 USB 磁盘中,然后创建可引导磁盘。确保将你的引导设置更改为使用 USB 引导并重新启动系统。
#### 步骤 3) Manjaro Live 版安装环境
系统重新启动时,它将自动检测到 USB 驱动器并开始启动进入 Manjaro Live 版安装屏幕。
![Boot-Manjaro-18-1-kde-installation][3]
接下来,使用箭头键选择 “<ruby>启动Manjaro x86\_64 kde<rt>Boot: Manjaro x86\_64 kde</rt></ruby>”,然后按回车键以启动 Manjaro 安装程序。
#### 安装 4) 选择启动安装程序
接下来,将启动 Manjaro 安装程序如果你已连接到互联网Manjaro 将自动检测你的位置和时区。单击 “<ruby>启动安装程序<rt>Launch Installer</rt></ruby>”,开始在系统中安装 Manjaro 18.1 KDE 版本。
![Choose-Launch-Installaer-Manjaro18-1-kde][4]
#### 步骤 5) 选择语言
接下来,安装程序将带你选择你的首选语言。
![Choose-Language-Manjaro18-1-Kde-Installation][5]
选择你想要的语言,然后单击“<ruby>下一步<rt>Next</rt></ruby>”。
#### 步骤 6) 选择时区和区域
在下一个屏幕中,选择所需的时区和区域,然后单击“<ruby>下一步<rt>Next</rt></ruby>”继续。
![Select-Location-During-Manjaro18-1-KDE-Installation][6]
#### 步骤 7) 选择键盘布局
在下一个屏幕中,选择你喜欢的键盘布局,然后单击“<ruby>下一步<rt>Next</rt></ruby>”继续。
![Select-Keyboard-Layout-Manjaro18-1-kde-installation][7]
#### 步骤 8) 选择分区类型
这是安装过程中非常关键的一步。 它将允许你选择:
* 擦除磁盘
* 手动分区
* 并存安装
* 替换分区
如果要在 VM虚拟机中安装 Manjaro 18.1,则将看不到最后两个选项。
如果你不熟悉 Manjaro Linux那么我建议你使用第一个选项<ruby>擦除磁盘<rt>Erase Disk</rt></ruby>),它将为你自动创建所需的分区。如果要创建自定义分区,则选择第二个选项“<ruby>手动分区<rt>Manual Partitioning</rt></ruby>”,顾名思义,它将允许我们创建自己的自定义分区。
在本教程中,我将通过选择“<ruby>手动分区<rt>Manual Partitioning</rt></ruby>”选项来创建自定义分区:
![Manual-Partition-Manjaro18-1-KDE][8]
选择第二个选项,然后单击“<ruby>下一步<rt>Next</rt></ruby>”继续。
如我们所见,我有 40 GB 硬盘,因此我将在其上创建以下分区,
* `/boot`         2GBext4
* `/`             10 GBext4
* `/home`        22 GBext4
* `/opt`         4 GBext4
* <ruby>交换分区<rt>Swap</rt></ruby>       2 GB
当我们在上方窗口中单击“<ruby>下一步<rt>Next</rt></ruby>”时,将显示以下屏幕,选择创建“<ruby>新分区表<rt>new partition table</rt></ruby>”:
![Create-Partition-Table-Manjaro18-1-Installation][9]
点击“<ruby>确定<rt>OK</rt></ruby>”。
现在选择可用空间,然后单击“<ruby>创建<rt>create</rt></ruby>”以将第一个分区设置为大小为 2 GB 的 `/boot`
点击“<ruby>确定<rt>OK</rt></ruby>”。
现在选择可用空间,然后单击“<ruby>创建<rt>create</rt></ruby>”以将第一个分区设置为大小为 2 GB 的 `/boot`
![boot-partition-manjaro-18-1-installation][10]
单击“<ruby>确定<rt>OK</rt></ruby>”以继续操作,在下一个窗口中再次选择可用空间,然后单击“<ruby>创建<rt>create</rt></ruby>”以将第二个分区设置为 `/`,大小为 10 GB
![slash-root-partition-manjaro18-1-installation][11]
同样,将下一个分区创建为大小为 22 GB 的 `/home`
![home-partition-manjaro18-1-installation][12]
到目前为止,我们已经创建了三个分区作为主分区,现在创建下一个分区作为扩展分区:
![Extended-Partition-Manjaro18-1-installation][13]
单击“<ruby>确定<rt>OK</rt></ruby>”以继续。
创建大小分别为 5 GB 和 2 GB 的 `/opt` 和交换分区作为逻辑分区。
![opt-partition-manjaro-18-1-installation][14]
![swap-partition-manjaro18-1-installation][15]
完成所有分区的创建后,单击“<ruby>下一步<rt>Next</rt></ruby>”:
![choose-next-after-partition-creation][16]
#### 步骤 9) 提供用户信息
在下一个屏幕中,你需要提供用户信息,包括你的姓名、用户名、密码、计算机名等:
![User-creation-details-manjaro18-1-installation][17]
提供所有信息后,单击“<ruby>下一步<rt>Next</rt></ruby>”继续安装。
在下一个屏幕中,系统将提示你选择办公套件,因此请做出适合你的选择:
![Office-Suite-Selection-Manjaro18-1][18]
单击“<ruby>下一步<rt>Next</rt></ruby>”以继续。
#### 步骤 10) 摘要信息
在完成实际安装之前,安装程序将向你显示你选择的所有详细信息,包括语言、时区、键盘布局和分区信息等。单击“<ruby>安装<rt>Install</rt></ruby>”以继续进行安装过程。
![Summary-manjaro18-1-installation][19]
#### 步骤 11) 进行安装
现在,实际的安装过程开始,一旦完成,请重新启动系统以登录到 Manjaro 18.1 KDE 版:
![Manjaro18-1-Installation-Progress][20]
![Restart-Manjaro-18-1-after-installation][21]
#### 步骤 12) 安装成功后登录
重新启动后,我们将看到以下登录屏幕,使用我们在安装过程中创建的用户凭据登录:
![Login-screen-after-manjaro-18-1-installation][22]
点击“<ruby>登录<rt>Login</rt></ruby>
![KDE-Desktop-Screen-Manjaro-18-1][23]
就是这样!你已经在系统中成功安装了 Manjaro 18.1 KDE 版,并探索了所有令人兴奋的功能。请在下面的评论部分中发表你的反馈和建议。
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/
作者:[Pradeep Kumar][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lujun9972
[1]: https://manjaro.org/download/official/kde/
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Boot-Manjaro-18-1-kde-installation.jpg
[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Launch-Installaer-Manjaro18-1-kde.jpg
[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Language-Manjaro18-1-Kde-Installation.jpg
[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Location-During-Manjaro18-1-KDE-Installation.jpg
[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Keyboard-Layout-Manjaro18-1-kde-installation.jpg
[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manual-Partition-Manjaro18-1-KDE.jpg
[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Create-Partition-Table-Manjaro18-1-Installation.jpg
[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/boot-partition-manjaro-18-1-installation.jpg
[11]: https://www.linuxtechi.com/wp-content/uploads/2019/09/slash-root-partition-manjaro18-1-installation.jpg
[12]: https://www.linuxtechi.com/wp-content/uploads/2019/09/home-partition-manjaro18-1-installation.jpg
[13]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Extended-Partition-Manjaro18-1-installation.jpg
[14]: https://www.linuxtechi.com/wp-content/uploads/2019/09/opt-partition-manjaro-18-1-installation.jpg
[15]: https://www.linuxtechi.com/wp-content/uploads/2019/09/swap-partition-manjaro18-1-installation.jpg
[16]: https://www.linuxtechi.com/wp-content/uploads/2019/09/choose-next-after-partition-creation.jpg
[17]: https://www.linuxtechi.com/wp-content/uploads/2019/09/User-creation-details-manjaro18-1-installation.jpg
[18]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Office-Suite-Selection-Manjaro18-1.jpg
[19]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Summary-manjaro18-1-installation.jpg
[20]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manjaro18-1-Installation-Progress.jpg
[21]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Restart-Manjaro-18-1-after-installation.jpg
[22]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Login-screen-after-manjaro-18-1-installation.jpg
[23]: https://www.linuxtechi.com/wp-content/uploads/2019/09/KDE-Desktop-Screen-Manjaro-18-1.jpg

View File

@ -0,0 +1,81 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Use sshuttle to build a poor mans VPN)
[#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/)
[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/)
使用 shuttle 构建一个穷人的 VPN
======
![][1]
如今,企业网络经常使用 VPN虚拟专用网络[来保证员工通信安全][2]。但是,使用的协议有时会降低性能。如果你可以使用 SSH 连接远程主机,那么你可以设置端口转发。但这可能会很痛苦,尤其是在你需要与该网络上的许多主机一起使用的情况下。试试 **sshuttle**,它可以通过 SSH 访问来设置快速简易的 VPN。请继续阅读以获取有关如何使用它的更多信息。
sshuttle 正是针对上述情况而设计的。远程端的唯一要求是主机必须有可用的 Python。这是因为 sshuttle 会构造并运行一些 Python 代码来帮助传输数据。
### 安装 sshuttle
sshuttle 被打包在官方仓库中,因此很容易安装。打开一个终端,并使用[使用 sudo][3] 运行以下命令:
```
$ sudo dnf install sshuttle
```
安装后,你可能会发现手册页很有趣:
```
$ man sshuttle
```
### 设置 VPN
最简单的情况就是将所有流量转发到远程网络。这不一定是一个疯狂的想法,尤其是如果你不在自己家里这样的受信任的本地网络中。将 _-r_ 选项与 SSH 用户名和远程主机名一起使用:
```
$ sshuttle -r username@remotehost 0.0.0.0/0
```
但是,你可能希望将 VPN 限制为特定子网,而不是所有网络流量。 (有关子网的完整讨论超出了本文的范围,但是你可以在 [Wikipedia][4] 上阅读更多内容。)假设你的办公室内部使用了预留的 A 类子网 10.0.0.0 和预留的 B 类子网 172.16.0.0。上面的命令变为:
```
$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16
```
这非常适合通过 IP 地址访问远程网络的主机。但是如果你的办公室是一个拥有大量主机的大型网络该怎么办名称可能更方便甚至是必须的。不用担心sshuttle 还可以使用 _dns_ 选项转发 DNS 查询:
```
$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16
```
要使 sshuttle 已守护进程运行,请加上 _-D_ 选项。它会以 syslog 兼容的日志格式发送到 systemd 日志中。
根据本地和远程系统的功能,可以将 shuttle 用于基于 IPv6 的 VPN。如果需要你还可以设置配置文件并将其与系统启动集成。如果你想阅读更多有关 sshuttle 及其工作方式的信息,请[查看官方文档][5]。要查看代码,请[进入 GitHub 页面][6]。
* * *
_由 _[_Kurt Cotoaga_][7]_ 拍摄并发表在 _[_Unsplash_][8]_ 上。_
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/
作者:[Paul W. Frields][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/pfrields/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/sshuttle-816x345.jpg
[2]: https://en.wikipedia.org/wiki/Virtual_private_network
[3]: https://fedoramagazine.org/howto-use-sudo/
[4]: https://en.wikipedia.org/wiki/Subnetwork
[5]: https://sshuttle.readthedocs.io/en/stable/index.html
[6]: https://github.com/sshuttle/sshuttle
[7]: https://unsplash.com/@kydroon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[8]: https://unsplash.com/s/photos/shuttle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText