Linux (ubuntu) to build a java program environment, ubuntujava
I. Introduction
Ubuntu is similar to linux. We need to build a java program running environment on the system. jdk and mysql must be installed. tomcat is a green version, you can use taz-zxvf tomcat directly. However, before installing these software, I also installed ssh and some common linux commands, such as vim and unzip.
The ip address of the test environment is 192.168.71.138.
Ii. Software Installation
2.1 install the vim command
Sudo apt-get install vim
2.2 install the unzip command
Sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack lha arj cabextract file-roller
After the installation, I still cannot execute the zip command and enter apt install unzip again (whether it is zip or unzip, I cannot remember it, and the ubuntun prompts me)
2.3 Install ssh.
$ Sudo apt-get install openssh-server
The system will automatically install the service. After the installation is complete, start the service:
$ Sudo/etc/init. d/ssh start
After the service is started, run the following command to check whether the service is correctly started:
$ Ps-e | grep ssh, for example:
Xxxx? 00:00:00 sshd
The preceding command indicates that OK is enabled. Note: The default ssh port is 22. You can change the port and stop it first,
Then start. Modify the configuration in/etc/ssh/sshd_config, as shown below.
Note: After the installation is complete, the shh still cannot be remotely connected through the root, and an error occurs during client connection (Login failed: server responded "algorithm negotiation failed"). The solution is as follows:
Modify the ssh configuration file/etc/ssh/sshd_config
Add the following in the configuration file:
Ciphers aes128-cbc, aes192-cbc, aes256-cbc, aes128-ctr, aes192-ctr, aes256-ctr, 3des-cbc, arcfour128, arcfour256, arcfour, blowfish-cbc, cast128-cbc
MACs hmac-md5, hmac-sha1, umac-64@openssh.com, hmac-ripemd160, hmac-sha1-96, hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1, diffie-hellman-group-exchange-sha256, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group1-sha1
After the sshd service is restarted, the connection can be established normally.
Sudo service ssh restart;
After the connection is normal, you still cannot use root login. You also need to modify the sshd-config file.
Remember to restart ssh,Sudo service ssh restart;
2.4 install jdk
Tar-zxvf jdk-8u60-linux-x64.tar.gz
After the supervisor downloads jdk-8u60-linux-x64.tar.gz from the supervisor and transmits it to the java Runtime Environment through ssh.
After installation, you must configure JAVA_HOME and PATH in/etc/environment,
JAVA_HOME =/usr/java/jdk1.7
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/games:/usr/java/jdk1.7/bin"
After the configuration is complete, update the environment. The update command is source environment;
Now we can query jdk version informatization through java-version.
2.5 install mysql
Installing MySQL on Ubuntu is very simple and requires only a few commands.
1. sudo apt-get install mysql-server
2. apt-get isntall mysql-client
3. sudo apt-get install libmysqlclient-dev
During the installation process, you will be prompted to set the password or something. Do not forget to set the password. After the installation is complete, run the following command to check whether the installation is successful:
Sudo netstat-tap | grep mysql
After the preceding command check, if mysql's socket is in the listen status, the installation is successful.
To log on to the mysql database, run the following command:
Mysql-u root-p
-U indicates the login user name and-p indicates the Login User Password. After the above command is entered, a prompt is displayed for entering the password. Then, you can log on to mysql by entering the password.
After mysql is installed, the local database can be accessed normally.
However, other hosts are still inaccessible and the 10061 error occurs. You need to modify the configuration file and restart mysql.
Grant all privileges on *. * TO 'myuser' @ '%' identified by 'mypassword' wi th grant option;
If the last command is still invalid, modify the my. cnf file.
[Mysqld]
Bind-address = 0.0.0.0
After modification, use netstat-an | grep 3306. If it is 0.0.0.0: 3306, it is normal.
2.6 unzip tomcat
Run the unzip tomcat.zip command to upload the test project to tomcat/webapps by Using ssh, and enter the tomcat/bin directory. /catalina. run the sh run Command to start the debug mode of tomcat. There is nothing to say about this. access through the browser normally.