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

Use Docker to build a Redis master-slave replication cluster

In a cluster with master-slave replication mode, ...

How to build a virtual machine with vagrant+virtualBox

1. Introduction Vagrant is a tool for building an...

In-depth explanation of currying of JS functions

Table of contents 1. Supplementary knowledge poin...

Example of customizing the style of the form file selection box

Copy code The code is as follows: <!DOCTYPE ht...

Goodbye Docker: How to Transform to Containerd in 5 Minutes

Docker is a very popular container technology. Th...

Example analysis of the impact of MySQL index on sorting

This article uses examples to illustrate the impa...

Steps to deploy ingress-nginx on k8s

Table of contents Preface 1. Deployment and Confi...

How to backup MySQL regularly and upload it to Qiniu

In most application scenarios, we need to back up...

How to use http and WebSocket in CocosCreator

Table of contents 1. HttpGET 2. HTTP POST WebSock...

Detailed explanation of PHP+nginx service 500 502 error troubleshooting ideas

Overview When a 500 or 502 error occurs during ac...

How to add shortcut commands in Xshell

As a useful terminal emulator, Xshell is often us...

MySQL scheduled backup solution (using Linux crontab)

Preface Although some love in this world has a pr...

Docker network principles and detailed analysis of custom networks

Docker virtualizes a bridge on the host machine. ...

Sample code for implementing music player with native JS

This article mainly introduces the sample code of...