Home > Article > System Tutorial > What are apt-get and ppa sources? Differences from apt-get sources
This newbie is a coder in the Windows camp. Both the server and the client use Windows. I recently installed Ubuntu16.04LTS on a virtual machine. I feel that it is not easy to play, so I will record it first. When learning new things, novices like to make analogies and compare new knowledge with previously understood concepts. It is possible to understand the meaning of some more concrete and obscure concepts through comparison.
This time it is because you need to install and configure pycharm, so by the way, I will record some understandings in the process of configuring Ubuntu16.04LTS environment variables. The first step is to configure the jdk environment. Pycharm is one of the products of jetbrains. The company's other products include webstorm and PHPStorm. Installing and deploying JDK on Windows is very simple. Double-click the installer, and then configure the environment variables. How to run the file system of the Unix system without extensions (to be precise, the Unix and Unix-like operating system camp, hereafter called the Unix camp) I had no idea about the installation program, so I searched online for how to install jdk on Ubuntu. There are roughly two ways. Use the apt-get command to add the ppa source installation or download the installation package for the Linux platform from the official website. One of the blog posts recommended using apt -get command installation, it said that it can be updated manually, but I didn't understand what it meant, so I installed it using these methods, although it can be updated manually. So, let’s find out what the apt-get and ppa sources are?
apt-get can be understood as a tool integrated into the system. It is similar to ping and telnet in Windows. Its function is to manage software packages. In fact, I have not continued to study whether there is a better tool than it. Naturally, I don't know the pros and cons compared to other similar tools, but I just use it.
As for the ppa sourcelinux modification of user environment variables, the spirit of the Unix camp is open source. In fact, there is a software foundation. Here I regard it as an official software library, and this software library It is maintained by the official, which is regarded as the Unix camp. All software that can be released in this software library must pass official inspection. A simple understanding is that new software or new versions that pass quality inspection can be released. Which alpha versions and beta versions cannot be released directly. Generally, upcoming versions can be released when they are stable. Therefore, there is the concept of ppa source. Although ppa source can be regarded as a private software library, the threshold for software released here is not as high as the official one. There will be the latest versions of many software, but most of them are alpha, beta and the like.
After knowing apt-get and ppa, I continued the installation of jdk. Although Ubuntu already comes with jdk, openjdk, and after understanding, there is also oraclejdk, which is probably the relationship between Mi UI and native Android, but fortunately it has After checking the difference between openjdk and oraclejdk, I accidentally realized that some people suggested not to remove the openjdk that comes with Ubuntu. The reason is that some functions or components of Ubuntu depend on openjdk, and uninstalling it may have unexpected consequences. As for the specific adverse effects, I didn’t go into details, so I happily continued to install oraclejdk without uninstalling it.
sudoadd-apt-repositoryppa:webupd8team/java#Add the webupd8team/java software library. This later reduced software library will be added to the path /etc/apt/sources.list.d. After running this command, in Sources.list.d will generate two files, webupd8team-ubuntu-java-xenial.list and webupd8team-ubuntu-java-xenial.list.save. Deleting these two files will remove the software library
sudoapt-getupdate#Equivalent to re-reading the latest changes
sudoapt-getinstalloracle-java8-installer#Install oraclejdk
I'm stuck here. I don't know if it's due to operational problems or some other reason. In fact, although the oraclejdk still cannot be installed, when running java, it prompts "There are default-jdk, openjdk, etc., try apt-getinstall" "Installation", and there is no oraclejava8 or other related words in the list, so I searched online and forgot where I saw it. It seemed that Ubuntu 14 does not support ppa source installation. The authenticity was not verified, and I thought that this oraclejdk Never installed it. So I decisively abandoned the use of ppa source installation and switched to downloading the installation package myself.
Go to the oracle official website and find the Linux version of jdk. There is a tar compression package and an rpm suffix. I have never seen rpm, so I understand it as a package containing source code that needs to be compiled by myself, and decisively choose the more familiar tar compression. Package, more than 300 MB, download, who knows who uses it, after waiting for a long time, it has not been downloaded, the dedicated line is 200m, the download of Firefox that comes with it is extremely slow. After that, I had no choice but to configure uget aria2, and the pelican-like speed I expected did not come. Finally, I figured out the possible reason is that uget aria2 is not as naturally suitable for our people as Thunder. (Xunlei will manually search for resources on other nodes on the Internet. Maybe uget aria2 is a genelinux modifying user environment variables outside the Great Wall, so it cannot bring the Thunder experience). Finally, download it with the host machine, and then copy it to the virtual machine with a USB flash drive. Fortunately, the Unix camp can support ntfs and fat32 format storage media. On the contrary, Windows is not so friendly. Windows itself does not support ext2/ext3 (still I don’t know?).
Finally, I got the installation package of oraclejdk and started the installation. The installation in these ways is very simple. Just unzip it to the specified directory. The main thing is to understand the configuration mechanism. I talked a lot of nonsense above, and finally got to the topic. .
The file system of the Unix camp is different from that of Windows. Windows has different partitions such as c, d, e, f disks, etc., while the Unix camp is similar to Android. It should be that Android is based on the Linux kernel. Mainly There are /home, /bin, /boot, /etc, /lib, /root, /usr, /var, etc. After understanding, I decompressed oraclejdk to the /usr/lib/jvm path, mainly because of this path There are also various jdk versions that originally came with Ubuntu, including the openjdk mentioned above, so oraclejdk is also placed here. Next, you need to change the environment variables. There are several ways to configure environment variables in the Unix camp. Although these statements are not rigorous, because the principle of Ubuntu environment variables is not much different from that of Windows. They are divided into system variables and user variables. As for all There are several Linux shell methods mentioned, but each method is configured in a different file, and this file will be loaded at different stages. For example, /etc/profile is a variable for all users, and will be loaded every time they log in or It will be loaded every time a bash instance is started; ~/.bashrc is the current user variable, which will be loaded every time the user logs in or starts a bash instance; and ~/.bash_profile and ~/.profile are only loaded when logging in. Loading, the difference is that ~/.bash_profile is only provided for bash to read, while ~/.profile is provided for various shells to read, such as csh, tcsh, dash, etc.
Here I configured the environment variables to the /etc/profile file. Ubuntu can use its own gedit to edit. In fact, you can also use vim and emacs. These are equivalent to the Windows Notepad program but are more powerful than Notepad. , I am used to using Notepad, so I may be a little uncomfortable with this text editor.
sudogedit/etc/profile#Open the profile file with gedit
#Add the following content at the end of the file
exportJAVA_HOME=/usr/lib/jvm/jdk1.8.0_121#The oraclejdk decompression path mentioned in it
exportJRE_HOME=${JAVA_HOME}/jre#javaruntimeenvironment
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib#classpath, this is the same as windows, you must add a dot
exportPATH=${JAVA_HOME}/bin:$PATH#path
#Although it is almost the same as windows, it is just separated by multiple uses: instead of ;
#Reread environment variables
source/etc/profile
If it is Windows, the installation and configuration of jdk has been completed. When running java or javac in dos, it is no longer "java is not an internal command" and the like. However, Ubuntu has not finished yet. If the default jdk version has not been configured yet, When typing java in term, you may still be prompted with "There are default-jdk, openjdk, etc., try apt-getinstall installation." Still need to continue configuring, I understand it as configuration command mapping.
sudoupdate-alternatives--configjava#Check whether the system has already installed jdk
update-alternatives: Error: No candidate for java #Output If jdk is not installed, the system cannot recognize the java command, that is, no command mapping is configured
#Create java, javac, jar, javah, javap command mapping
sudoupdate-alternatives--install/usr/bin/javajava/usr/lib/jvm/jdk1.7.0_60/bin/java1
sudoupdate-alternatives--install/usr/bin/javacjavac/usr/lib/jvm/jdk1.7.0_60/bin/javac1
sudoupdate-alternatives--install/usr/bin/jarjar/usr/lib/jvm/jdk1.7.0_60/bin/jar1
sudoupdate-alternatives--install/usr/bin/javahjavah/usr/lib/jvm/jdk1.7.0_60/bin/javah1
sudoupdate-alternatives--install/usr/bin/javapjavap/usr/lib/jvm/jdk1.7.0_60/bin/javap1
sudoupdate-alternatives--install/usr/bin/javajava/usr/lib/jvm/jdk1.8.0_121/bin/java2
sudoupdate-alternatives--install/usr/bin/javacjavac/usr/lib/jvm/jdk1.8.0_121/bin/javac2
sudoupdate-alternatives--install/usr/bin/jarjar/usr/lib/jvm/jdk1.8.0_121/bin/jar2
sudoupdate-alternatives--install/usr/bin/javahjavah/usr/lib/jvm/jdk1.8.0_121/bin/javah2
sudoupdate-alternatives--install/usr/bin/javapjavap/usr/lib/jvm/jdk1.8.0_121/bin/javap2
The update-alternatives command is used to create the mapping of each command above. --install means installation. The path next to install can be regarded as a shortcut method in Windows. In Linux, it is actually called a soft link. The java in the middle is ours. When using java on the command line, the path next to java is the source program that the shortcut method is actually connected to. The two versions of the shortcut method here point to the same one, but the actual source program is different. The last number is the priority, and the value The larger the value, the more priority the Linux command vi. We run the java-version command on the term. Bash will select the response version according to the priority. You can run the following command to switch different versions of the response source program
sudoupdate-alternatives--configjava
There are 2 candidates for replacing java (provided /usr/bin/java).
Select path priority status
-------------------------------------------------- -------------
0/usr/lib/jvm/jdk1.8.0_121/bin/java301Manual mode
1/usr/lib/jvm/java-8-openjdk-i386/jre/bin/java300automatic mode
*2/usr/lib/jvm/jdk1.8.0_121/bin/java301Auto mode
To maintain the current value [*] press, or type the selected number: 1
update-alternatives: Use /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java to serve /usr/bin/java(java) in automatic mode
Follow the prompts and enter different numbers to switch. Of course, you can also switch by changing the java_home environment variable
Finally, I also changed the default Python compiler to anaconda2, so that I don’t have to go through the trouble of downloading various scientific estimation packages
ty@Ubuntu:/$sudoupdate-alternatives--configpython
There are 3 candidates for replacing python (provided /usr/bin/python).
Select path priority status
-------------------------------------------------- -------------
0/home/ty/anaconda2/bin/python2.7302Manual mode
*1/home/ty/anaconda2/bin/python2.7302Auto mode
2/usr/bin/python2.7301Auto mode
3/usr/bin/python3.5300Auto mode
To maintain the current value [*] press, or type the selected number: 1
Run the python command in term, you can directly import numpy
python
Python2.7.13|Anaconda4.3.0(32-bit)|(default,Dec202016,23:08:16)
[GCC4.4.720120313(RedHat4.4.7-1)]onlinux2
The above is the detailed content of What are apt-get and ppa sources? Differences from apt-get sources. For more information, please follow other related articles on the PHP Chinese website!