Initialize Ubuntu 16.04 in three minutes, deploy Java, Maven, and Docker environments

Initialize Ubuntu 16.04 in three minutes, deploy Java, Maven, and Docker environments

Fast-Linux project address: https://gitee.com/uitc/Fast-Linux

introduce

Initializing Linux and setting up some commonly used environments is a simple but time-consuming task, especially when your Linux crashes due to some uncontrollable factors, which means you have to deploy the environment again from scratch, which is a bit maddening. So I came up with the idea of ​​building this Linux initialization script library. No matter you are a novice or an expert, you only need to run it with one click and then have a cup of coffee, and the environment can be successfully built. Isn't it wonderful?

Due to my limited personal ability, I can only summarize the environment scripts I encountered (I am a Java developer and am not familiar with python, c/c++, etc.)

Due to the large number of Linux versions and various development environments, this is a repository that needs everyone's contribution to become more and more powerful. Welcome to fork push start!!!

Tutorial

  1. For newly installed Linux, make sure you are logged in as the root user. If not, use sudo passwd root to set an initial password for your root and then log in again.
  2. Enter cd and press Enter to enter the user directory (other directories are also OK, it is recommended to put it in the user directory) and run git clone https://gitee.com/qiu-qian/Fast-Linux.git to clone the project
  3. Enter the Linux system corresponding to your version. For example, if I am running Ubuntu 16.04, enter cd Fast-Linux/ubuntu/ubuntu16-04/
  4. Follow the instructions to find the environment you want to deploy, and then set it as an executable file. For example, if I want to use start.sh, enter chmod 700 start.sh
  5. Just run the script, for example, if I want to use start.sh, enter ./start.sh
  6. Sat down and had a cup of coffee. .

Script update log

(Note: If you need to submit, please add it after this log to indicate the script path and environment combination you added, in a unified format for easy management)

2020/7/26

  • ubuntu/ubuntu16-04/start.sh
  • Set up domestic Apt source
  • Allow root user to log in remotely via ssh
  • jdk-8u251 environment
  • apache-maven-3.6.3 environment (Alibaba Cloud Maven repository)
#Set apt source echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiversec" >/etc/apt/sources.list

#Update apt source apt-get update

#Allow root users to log in remotely via ssh sed -i "s/PermitRootLogin prohibit-password/#PermitRootLogin prohibit-password\nPermitRootLogin yes/g" /etc/ssh/sshd_config

#Restart the ssh service service ssh restart

#Append system commands to user variables to prevent the restart command from failing echo 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games' >>/etc/profile

#Create a new folder and allocate resources mkdir /usr/local/java
mkdir /usr/local/maven
cp settings.xml /usr/local/maven

#Install Java
cd /usr/local/java
#Download the java installation package curl -o jdk-8u251-linux-x64.tar.gz https://code.aliyun.com/kar/oracle-jdk/raw/3c932f02aa11e79dc39e4a68f5b0483ec1d32abe/jdk-8u251-linux-x64.tar.gz
tar -zxvf jdk-8u251-linux-x64.tar.gz
rm jdk-8u251-linux-x64.tar.gz
#Add java system environment variables (available to all users)
echo 'export JAVA_HOME=/usr/local/java/jdk1.8.0_251' >>/etc/environment
echo 'export JRE_HOME=/usr/local/java/jdk1.8.0_251/jre' >>/etc/environment
echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >>/etc/environment
echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >>/etc/environment
#Add java user environment variable echo 'export JAVA_HOME=/usr/local/java/jdk1.8.0_251' >>/etc/profile
echo 'export JRE_HOME=/usr/local/java/jdk1.8.0_251/jre' >>/etc/profile
echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >>/etc/profile
echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >>/etc/profile

#Install Maven
cd /usr/local/maven
#Download the Maven installation package curl -o apache-maven-3.6.3-bin.tar.gz https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
rm apache-maven-3.6.3-bin.tar.gz
#Add Maven system environment variables (available to all users)
echo 'export M2_HOME=/usr/local/maven/apache-maven-3.6.3' >>/etc/environment
echo 'export CLASSPATH=$CLASSPATH:$M2_HOME/lib' >>/etc/environment
echo 'export PATH=$PATH:$M2_HOME/bin' >>/etc/environment
#Add Maven user environment variables echo 'export M2_HOME=/usr/local/maven/apache-maven-3.6.3' >>/etc/profile
echo 'export CLASSPATH=$CLASSPATH:$M2_HOME/lib' >>/etc/profile
echo 'export PATH=$PATH:$M2_HOME/bin' >>/etc/profile
#Create a new Maven repository mkdir repository
#Modify Maven's configuration file# rm apache-maven-3.6.3/conf/settings.xml
mv settings.xml apache-maven-3.6.3/conf

#Reboot
  • ubuntu/ubuntu16-04/docker.sh
  • Install Docker (domestic image)
  • Install docker-compose
#Docker environment setup script#Download Docker
curl -fsSL get.docker.com -o get-docker.sh
# sh get-docker.sh --mirror Aliyun
sh get-docker.sh --mirror AzureChinaCloud

#Configure mirror acceleration echo "{\"registry-mirrors\": [\"https://qy5lms4s.mirror.aliyuncs.com\"]}" >/etc/docker/daemon.json
#Restart the service systemctl daemon-reload
systemctl restart docker
#Pull ubuntu:16.04 test docker pull ubuntu:16.04

#Installation of docker-compose curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m) >/usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

This is the end of this article about how to initialize Ubuntu 16.04, deploy Java, Maven, and Docker environments in three minutes. For more information about how to initialize Java, Maven, and deploy Docker environments in Ubuntu 16.04, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Implementation of unified management of version numbers using Maven BOM in Java
  • Several common ways to package and publish Java projects to Maven private warehouses
  • Kotlin java mixed code maven packaging implementation
  • Detailed tutorial on Java (JDK/Tomcat/Maven) runtime environment configuration and tool (idea/eclipse) installation
  • Instructions for downloading and installing Maven in Java
  • Using JAVA+Maven+TestNG framework to implement super detailed Appium testing Android real machine tutorial
  • Jenkins+Maven+SVN automatic deployment of Java projects
  • How to use jekins to automatically build and deploy java maven projects
  • Problems and solutions for configuration files in the Maven project src/main/java directory that cannot be exported or effective
  • Solve the problem that IDEA2020 creates a Maven project without src/main/java directory and webapp directory
  • How to manage Java project dependencies through Maven
  • IDEA configures the Java development environment (maven, gradle, tomcat)
  • The color of the Java file of the Maven project in Intellij Idea is wrong and it is not recognized. Solution
  • Solve the problem that the java maven project cannot find the jconsole-1.8.0.jar and tools-1.8.0.jar packages
  • Java Basics: A Brief Introduction to Maven

<<:  The principle and application of MySQL connection query

>>:  Understand all aspects of HTTP Headers with pictures and text

Recommend

Guide to using env in vue cli

Table of contents Preface Introduction-Official E...

Vue+thinkphp5.1+axios to realize file upload

This article shares with you how to use thinkphp5...

How to make Python scripts run directly under Ubuntu

Let’s take the translation program as an example....

Solve the problem of docker's tls (ssl) certificate expiration

Problem phenomenon: [root@localhost ~]# docker im...

How to get the height of MySQL innodb B+tree

Preface The reason why MySQL's innodb engine ...

A Brief Discussion on the Navigation Window in Iframe Web Pages

A Brief Discussion on the Navigation Window in If...

Cross-database association query method in MySQL

Business scenario: querying tables in different d...

mysql calculation function details

Table of contents 2. Field concatenation 2. Give ...

How to add conditional expressions to aggregate functions in MySql

MySQL filtering timing of where conditions and ha...

Analysis of the method of setting up scheduled tasks in mysql

This article uses an example to describe how to s...

MySQL Index Optimization Explained

In daily work, we sometimes run slow queries to r...

MySQL 8.0.17 installation graphic tutorial

This article shares with you the MySQL 8.0.17 ins...