Home  >  Article  >  System Tutorial  >  Debian 9.4 system installation and installation steps for Jdk and other tools

Debian 9.4 system installation and installation steps for Jdk and other tools

WBOY
WBOYforward
2024-01-08 18:46:31994browse

Installing Debian9.0.4 under Vmware

Create a new Vmware virtual machine

is relatively simple, skip this part

Install Debian9.0.4 in Vmware

Select the ISO image in the newly created virtual machine

Of course you can also refer to this article: https://www.jb51.net/os/619150.html

Start the virtual machine and see the following installation interface

Debian 9.4 系统安装及Jdk等工具安装方法

These options are:

  • Graphical interface installation
  • Install
  • advanced options
  • help
  • Speech synthesis installation

We choose intall (if you need to install a graphical interface, you can choose the first one), and you will enter the language selection interface

Debian 9.4 系统安装及Jdk等工具安装方法

Select "Yes" for the next operation, and then continue to the next step.

If you need to enter a domain name, you can enter your own domain name. If not, you can use localhost or leave it empty.

Set root account password and user account password

Choose options according to your needs when dividing disks. For this installation, "Use the entire disk" is selected.

Next, you can choose to install it according to your needs. Such as whether to use network mirroring, etc.

After the installation is complete, restart the virtual machine and enter the login interface. At this time, the graphical interface is used by default. After entering the system, click "Activities" in the upper left corner

Enter terminal in the search bar and click Terminal to enter the terminal

Debian 9.4 系统安装及Jdk等工具安装方法

After the installation is successful, the following prompt will appear when using the sudo command:

Debian 9.4 系统安装及Jdk等工具安装方法

This error occurs because: the basic operating system does not come with sudo, so we need to solve it ourselves.

The solution is as follows:

Use $su rootcommand to enter administrator privileges
Use apt-get install sudoInstall sudo

Debian 9.4 系统安装及Jdk等工具安装方法

Resolve "xxx is not in the sudoers file. This matter will be reported".

When an ordinary user enters sudo XXX on the command line, the following error will appear:

Debian 9.4 系统安装及Jdk等工具安装方法

The meaning of the sudo command is to allow the current user to execute commands as root. In fact, not all users can execute sudo, because users with permissions are in /etc/sudoers. So we can add permissions to users by editing the /etc/sudoers file.

Debian 9.4 系统安装及Jdk等工具安装方法

Because the file is 0440 and has read-only permission, use :wq! to force save after modification.

Opening and closing the graphical interface

After successful installation, the graphical interface will be entered by default. Our next operation hopes to be performed on the command line interface. Therefore, if you need to close the graphical interface, please refer to

for the specific closing process.

It really can’t be hurt to play a virtual machine under 32-bit XP. The memory occupied by Linux is also increasing by leaps and bounds these days. If you want to have gnome and kde... just open two virtual machine systems and you will need more than 2G of memory. It starts to crawl into the virtual memory and becomes stuck. Fortunately, when I first learned Linux, I started from the command line. If Debian boots up and enters the command line directly, the memory of about 128M will be more than enough.

Linux under the redhat system can be easily switched through init 3 and init 5. Today I found that init2~5 under the debian system seem to open gdm3 by default, so this method does not work.

The first thing that comes to mind is

/etc/init.d/gdm3 stop

, but this is still not streamlined enough.

The second idea is to turn off the gdm3 service and use the command

update-rc.d gdm3 -f remove

Delete all gdm3 related scripts in the rcX.d folder, so that there will be no graphical menu after booting up

The final method is to change grub and modify /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet [b]text[/b]"

after that

update-grub2

In this way, ordinary user login is logged in in command mode

If you suddenly want to use a graphical interface, then

/etc/init.d/gdm3 start

Install SSH Server

In the debian command line, enter $ sudo apt-get install ssh openssh-server to install SSH. After installing SSH, we can use putty or xshell to connect to debian in the virtual machine .

To connect to a virtual machine, you need to know the IP address of the virtual machine. You can use ifconfig under Linux to check the IP of the machine, but when you use it for the first time under Debian, the following error will occur:

Debian 9.4 系统安装及Jdk等工具安装方法

This is because the Debian system does not come with its own network package, so you need to install it yourself. By using the following command:

$ sudo apt-get install net-tools

Complete input

Debian 9.4 系统安装及Jdk等工具安装方法

Install JDK

Download JDK

You can first download using a physical machine and then upload using tools such as FileZilla
You can also use the wget command to download directly from the Internet. This tutorial uses the second method.

Debian 9.4 系统安装及Jdk等工具安装方法

Install JDK

Unzip jdk

Debian 9.4 系统安装及Jdk等工具安装方法

Configure environment variables

The path to the bin directory of jdk is: /home/xuda/jdk8/jdk1.8.0_171/bin. Next, you need to add environment variables
- Edit system environment variables

$ vi /etc/profile
//Append the following information to the file (root permissions are required)
export JAVA_HOME=/home/xuda/jdk8/jdk1.8.0_171/
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

Debian 9.4 系统安装及Jdk等工具安装方法

- Load the previous configuration

$ source /etc/profile

Debian 9.4 系统安装及Jdk等工具安装方法

- Verify configuration results

$ java -version

Debian 9.4 系统安装及Jdk等工具安装方法

Install GCC compilation environment

Download gcc source code

Download this tutorial and use the following source code

http://ftp.tsukuba.wide.ad.jp/software/gcc/snapshots/8-20180504/

You can download it to the physical machine first, and then upload it to the virtual machine using tools such as FileZilla.

Install dependent libraries

$ apt install build-essential libgmp-dev libmpfr-dev libmpc-dev

Compile GCC

Unzip XXX.tar.xz

Because the downloaded package ends with .tar.xz, you can know that this compressed package has undergone two layers of compression, the outer layer is xz compression method, and the inner layer is tar compression method. So it needs to go through two layers of decompression.

//Decompress the first layer
$ xz -d gcc-8-20180504.tar.xz
//Decompress the second layer
$ tar -xvf gcc-8-20180504.tar.xz

At this point we will get the decompressed file

Debian 9.4 系统安装及Jdk等工具安装方法

Compile and install

//1. Enter the directory
$ cd gcc-8-20180504/
//2. Compile and automatically generate makefile
$ ./configure --disable-multilib
//3. Run the following commands
$ make
//4. Wait for a while and then run
$ make install
//5. Restart and enter
$ gcc -version

In addition, there are many ways to install
1.apt-get install gcc
2.apt-get install make
3.apt-get install gdb
4.apt-get install build-essential
- Installation reference address

Install MySQL

refer to

In fact, this step can be installed directly using the apt-get toolkit. The purpose of the apt-get toolkit is to simplify the operation of Linux, and the usage effect is the same
Download the installation package

This tutorial is to install Mysql

download

$ wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

Unzip

$ tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

Debian 9.4 系统安装及Jdk等工具安装方法

Add user combination user

//Add user group
$ groupadd mysql
//Add user mysql to user group mysql
$ useradd -g mysql mysql

Debian 9.4 系统安装及Jdk等工具安装方法

Install

Create a new data folder in the mysql directory to store data

$ mkdir data

Debian 9.4 系统安装及Jdk等工具安装方法

In some tutorials, mysql_install_db may be used for installation. After 5.7, mysql_install_db was abandoned and replaced by mysqld --initialize

$ mysqld --initialize --basedir=/home/xuda/mysql/mysql-5.7 --datadir=/home/xuda/mysql/mysql-5.7/data/<br>

Debian 9.4 系统安装及Jdk等工具安装方法

An error occurred during the installation process: /usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

Solution: $ apt-get -f install

- Modify directory permissions
$ chown -R root .
//Mysql user only needs to be the owner of all files in the mysql-5.7.20/data/ directory
$ chown -R mysql data

Copy startup files

$ cp support-files/mysql.server /etc/init.d/mysqld
$ chmod 755 /etc/init.d/mysqld
$ cp my_print_defaults /usr/bin

Debian 9.4 系统安装及Jdk等工具安装方法

- Edit /etc/init.d/mysqld

//Modify the following content:
basedir=/usr/local/mysql-5.7.20/
datadir=/usr/local/mysql-5.7.20/data
port=3306
//You can use Nodepadd's ftp plug-in when modifying files, which is more convenient

Start service

$ service mysqld start

Log in

$mysql -u root -p

There is no password for the first login. You can use the following command to change the password later

mysql>use mysql;

>mysql>update user set authentication_string=password("new password") where user='root';

Debian 9.4 系统安装及Jdk等工具安装方法

Summarize

Because Debian is a very simple system, many tools are not pre-installed, so you will encounter many pitfalls during the installation process. Many tutorials on the Internet may not apply to you, so you have to explore it yourself.
If you have any questions please contact me.

The above is the detailed content of Debian 9.4 system installation and installation steps for Jdk and other tools. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete