Build a test environment under Linux (continuously updated)

1. Install jdk

1.1 Linux download and install tar.ga format

a. Use the rz command to upload the file (.tar.gz)
b. Unzip: tar -zxvf jdk-8u101-linux-x64.tar.gz
c. Copy the file to the specified directory mv jdk.1.8.0_101 /usr/local/ webserver/java
d. Configure environment variables vi /etc/profile

export JAVA_HOME=/usr/local/webserver/java/jdk1.8.0_101
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/bin/dt.jar:$JAVA_HOME/bin/tools.jar

and. JAVA_HOME

source /etc/profile

2. Install tomcat

2.1 Linux download and install tar.ga format

a. Use the rz command to upload the file (.tar.gz)
b. Unzip: tar -zxvf tomcatXXXX.tar.gz
c. Copy the file to the specified directory mv tomcat /usr/local/webserver/tomcat
d. Start tomcat and enter

/usr/local/webserver/apache-tomcat-8.5.5/bin/startup.sh

If displayed


 
 

Then the startup is successful
. e. Open port 8080 and add port 8080 to the firewall configuration, and perform the following operations

vi /etc/sysconfig/iptables

add the following code

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

f. Restart the firewall

service iptables restart

g. Browse to enter http://ip:8080

3. Install mysql

[centos]rpm file installation, using the rpm command
For an rpm package, it is composed of "-" and ".", basically composed of the following parts: * package name * version information * release version number * run Platform, when noarch appears, it means that the software is compatible with the platform
a. Install mysql: rpm mysql*

rpm -qa | grep mysql // This command will check whether the mysql database has been installed on the operating system

b. Startup method

1. Start with service:

[root@localhost /]# service mysqld start (version 5.0 is mysqld)
[root@szxdb etc]# service mysql start (version 5.5.7 is mysql)

2. Start using the mysqld script:

/etc/inint.d/mysqld start

3. Start with safe_mysqld:

safe_mysqld&

b. to stop

1. Start with service:

service mysqld stop

2. Start using the mysqld script:

/etc/inint.d/mysqld stop

3、mysqladmin shutdown

c. restart

1. Start with service:

service mysqld restart
service mysql restart (command in version 5.5.7)

2. Start using the mysqld script:

/etc/init.d/mysqld restart

3.1 Reset the mysql password (there are pits everywhere)

1. Modify MySQL login settings:

vi /etc/my.cnf

Add a sentence to the [mysqld] section

skip-grant-tables

E.g

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables

Save and exit vi.

2. Restart mysqld

Service mysqld start

3. Change the password

mysql -u root -p (press the space bar for password)
mysql>use mysql;
mysql> update user set
authentication_string=password('123456') where user='root' (Note: 'new pw' is your new password, other copy;

Another way of writing:

update mysql.user set
authentication_string=password('123456') where user='root'

4. Update

mysql>flush privileges;
mysql>quit;

5. Modify the MySQL login settings back:

vi /etc/my.cnf

Delete the skip-grant-tables just added to the [mysqld] segment

Save and exit vi.

3.2 Import database

create database database;
use database;
set names utf8;(set encoding)
source path

3.3 Export data and table result database

musqldump -h 127.0.0.1 -u root -p mydb > mydb.sql

OK!!!

3.4 References

http://www.cnblogs.com/debmzhang/p/5013540.html

http://www.cnblogs.com/ivictor/p/5142809.html

4. linux boot terminal

CentOS7 no longer uses the init hosting service and has changed to systemd, which naturally does not require the file /etc/inittab.
1. Command Mode

systemctl set-default multi-user.target

2. Graphics Mode

systemctl set-default graphical.target

5. Modify the root password

sudo passwd

6. Configure a static IP address

6.1. Edit the interface file

root@ubuntu:/# vim /etc/network/interfaces
auto ens33
iface ens33 inet static
address 192.168.2.27
netmask 255.255.255.0
gateway 192.168.2.1

Remember to turn off DHCP (automatically assign IP) when starting static

6.2. Configuring DNS

root@ubuntu:/# vim /etc/resolv.conf
nameserver 114.114.114.114

6.3. Restart the network

/etc/init.d/networking restart



Author: seven_hello
Link: https://www.jianshu.com/p/c6a3e1a1c418
Source: Jianshu The
copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325318534&siteId=291194637