In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Next, we will provide you with several useful console commands to facilitate the use of the process, by the way to learn the operation of Linux.
Command:
New folder: name of the new folder created by mkdir
Enter the folder: cd folder name
Return to the root directory: cd
-c download to the current folder for breakpoint continuation: link needed to download wget-c
View all the contents under the current folder: dir
Category highlights everything under the current file: ls
Delete: rm-rf directory name
Rename: mv source file new filename
Move files / folders: mv files folder
Second, install the JAVA JDK environment online
Note: JDK can be installed online or downloaded and transferred to the server. Choose online installation here
Good ~ with the front of the groundwork ~ next our progress will greatly catch up!
Step 1: download JDK 7 online
Because my local development environment is JDK7, in order to prevent any accident, my server will also be made into version 7, of course, you want a new 8, or even the latest 9 is no problem, we will provide a way ~ how to fish, or look at yourself.
As the direct du Niang JDK is version 8, then du Niang "JDK7" is good, open the Download page as follows.
Because my server is 64-bit, so download the version of the above picture, because the installation of rpm is more convenient, so I give up tar.gz, if I have a chance in the future (of course, it's best not to encounter it. This thing messed me up all afternoon. ), I will still take it out and update the blog post, and don't panic about downloading. After clicking on the download, get its real download address and copy it out. Since we are studying, of course we have to pretend to download directly under Linux.
Under Linux, enter
Wget-c http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm?AuthParam=1469608052_e2c30583645658b811e74e15f4fb04fb
Then, due to the sub-version problem, there should be no line break here, ha. Click enter and the download thread shown in the figure will appear.
Hehe ~ the speed is a little fast at night ~ 30000MB ~ Shehe ~ scares the baby.
After downloading, type the following instructions directly to install JDK
Rpm-ivh jdk-7u79-linux-x64.rpm
Enter ~ look at countless soaring lines of files and directories, and you can have a sip of water.
A moment later, after the installation (I had a screenshot for everyone to see the obsessive-compulsive disorder. But my current machine is only 1366-768, it's too long to cut it off, so it's all right anyway. It's the old rule to configure the JAVA environment.
Under the root directory (not sure whether it is the root directory or not, it depends on your input status. If you enter a folder, the current folder name will be displayed. If you enter a folder, you'd better exit to the root directory and enter cd directly), enter the following instructions:
Vi / etc/profile
Then the following figure appears
See the underlined place? Click any key to continue (don't tell me you can't find any key on the keyboard! ), what is written here has nothing to do with us at the moment. After clicking any key, you will see the following text interface.
OK ~ now, after entering this page, scroll down until you can no longer scroll, start to enter editing mode, and type the following path command:
JAVA_HOME=/usr/java/jdk1.7.0_79
CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
Export PATH CLASSPATH JAVA_HOME
As shown in the figure:
OK! Save ~ execute the following file
Source / etc/profile
Do not report a mistake and give a feedback ~ in fact, many of them have not been written on the Internet. Individual instructions are required to execute the file just edited below, which means to execute the file immediately. In other words, this means that the file you have selected will take effect immediately.
All right! Now let's see if JAVA is installed ~ type the following command to view the JAVA version:
Java-version
See the following prompt to complete the installation of JAVA and its environment configuration
Of course, by the way, if you dislike that your JDK version is too old, how do you update JDK?
It is much easier to uninstall JDK in Linux than in WIndows!
First, query the JDK package previously installed by rpm with the following command
Rpm-qa | grep java
When you find it, uninstall it with one click of the following command!
Rpm-e jdk-7u79-linux-x64.rpm
However, sometimes things are not satisfactory, but this time I am really lucky not to encounter some miserable buddies on the Internet who can not find the JDK package when they uninstall it. Then it is a pity that you can only uninstall it by deleting its directory, but this method is also very clean.
We passed
Which java
Or
Echo $JAVA_HOME
Command to find the directory of the old version of JDK installed before, and then rm them off. After uninstalling them, proceed to the old method and install the new JDK again. I won't repeat them here.
There is something called "upgrade / install" in PS:Linux 's rpm! This thing is very good, you can upgrade your rpm package directly, but the premise of this is that your rpm can find the previously installed package, otherwise, there may be a very serious problem with the installation. The two JAVA environments are confused. This is better to be careful. It is generally recommended to uninstall before installing. It is clean to uninstall anyway, isn't it?
After updating JAVA, you still need to modify the environment variables as you did before installing JDK, and then source ~
Third, install the Tomcat server online
good! Next, let's install Tomcat. In fact, the installation of Tomcat is the same as that of the JAVA environment, or even simpler (without configuring environment variables). Therefore, I will briefly explain it here, and I will mention it in one stroke.
First of all, download, I use Tomcat 7, so go directly to the download page of 7, only to find that there is rpm!? Hey, the old man is very sad ~ but it's all right ~ tgr.gz is still doing it!
The same routine as before, wget-c address, download it, and then extract it with the tar-zxvf filename command, the detailed code is as follows:
Wget-c http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz
Tar-zxvf apache-tomcat-7.0.70.tar.gz
Good ~ two commands can make the server decompress and work obediently. After the decompression is finished, I am used to putting them under the usr directory to look neat (obsessive-compulsive disorder! So, move to the / usr/local directory.
After that, edit the same place / etc/profile
Add one more line in the context of adding Java
TOMCAT_HOME=/usr/local/tomcat
Save and exit, then source, and then explain how to start the Tomcat server.
Cd / usr/local/tomcat/bin
Enter the bin directory under tomcat
. / startup.sh start the server
. / shutdown.sh stop the server
When you turn on the server, there should be the following content
You can usually use this command to see if the tomcat server is turned on
Ps-ef | grep java
The following indicates that the server is not turned on
The following indicates that the server has been turned on
All right, our Tomcat 7 is also installed here. If you don't need a database, you can deploy your project directly.
But before we do that, let's visit and see if it really works. Enter the following instructions to visit our localhost:8080 to see the content of the web page.
Curl http://localhost:8080
If there is a long list of html statements, congratulations! Your Tomcat 7 has been fully configured successfully
Of course, I wasn't so lucky. I got a hint like "reject the link".
I checked it on the Internet and found that it was related to the firewall. OK, then turn off Tomcat first.
The solution is as follows
Create a new file called tomcat.xml in the / etc/firewalld/services/ directory
Enter the following
< ?xml version="1.0" encoding="utf-8"? > < service> < short>Tomcat Webserver
< description>HTTPS is a modified HTTP used to serve Web pages when security is important. Examples are sites that require logins like stores or web mail. This option is not required for viewing pages locally or developing Web pages. You need the httpd package installed for this option to be useful.
< port protocol="tcp" port="8080"/> < /service>After that, save and exit, adding this service to the firewall rule
Firewall-cmd-reload
Firewall-cmd-add-service=tomcat
Firewall-cmd-permanent-add-service=tomcat
Since non-root users cannot listen on ports below 1023, it is said on the Internet that firewalld is used to forward all tcp packets destined for 80 to port 8080 before packets are routed, so execute the following command
Firewall-cmd-add-forward-port=port=80:proto=tcp:toport=8080
Firewall-cmd-permanent-add-forward-port=port=80:proto=tcp:toport=8080
Finally, firewall-cmd-reload, restart Tomcat, and perform the access again:
Curl http://localhost:8080
Finally saw the long-lost HTMLconversation!
So far! Tomcat will successfully solve the problems I encountered ~ however, this is not over! There's one more thing to do! When you see your Tom kitten! Please pay attention to this!
You click in and try it! I will ask you to enter the remote account password immediately. We haven't configured this account password yet! What's the hurry? Although this seems insignificant, after all, this is a tutorial and we still have to talk about it in more detail! Hurry up and come back, turn off the Tomcat and continue to configure!
Cd / usr/local/tomcat/conf
Go to the config management folder, and then
Vi tomcat-users.xml
Make changes in the
< tomcat-users>Add the following before the end of the label, note! The rules of Tomcat 6 are as follows:
< role rolename="admin"/ > < role rolename="manager"/ > < user username="admin" password="admin" roles="admin , manager"/ >Here's what Tomcat 7 says:
< role rolename="admin-gui"/ > < role rolename="manager-gui"/ > < user username="admin" password="admin" roles="admin-gui , manager-gui"/ >As shown in the picture above, you can do whatever you want with username and password, just remember it! This is the real end of the installation and configuration of Tomcat.
Fourth, install MySQL database online
good! Move on to the final step of this article-- install MySQL.
First of all, it is relatively casual to install MySQL under Linux compared with Windows environment. After all, I have installed it myself several times. If I uninstall it and install it again, there is no big problem at all, but there are a lot of problems without uninstalling cleanliness under Windows. However, since I don't know what happened before, maybe Ali Yun has his own? Or what, the installation did not succeed, and then I first uninstalled the MySQL clean, and then successfully installed.
Let's first explain how to uninstall:
"= gorgeous interlude split line ="
It is relatively easy to uninstall MySQL. You can first view the native MySql installation information by typing the following command
Rpm-qa | grep-I mysql
If the installation is successful, then there will be the relevant installed MySQL package, of course, in my tortured afternoon, except for the final installation, I have not seen once.
If you see it, then you are lucky to delete the package directly.
Rpm-ev package name
After you delete it, remember to delete the relevant old version of the development library and header files.
Rm-fr / usr/lib/mysql
Rm-fr / usr/include/mysql
You even have to find all the files and folders related to the word mysql and delete them as well!
Find /-name 'mysql'
Then drop all the rm found!
The data and / etc/my.cnf in / var/lib/mysql will not be deleted after uninstallation. If determined to be useless, delete them manually.
Rm-f / etc/my.cnf
Rm-fr / var/lib/mysql
So far, the unloading of Dafa ends here.
"= gorgeous interlude split line ="
Uninstall clean ~ we can start to install, through the old way, let's download MySQL to
Http://dev.mysql.com/downloads/mysql/5.5.html#downloads
You can open this interface, because I installed 5.5, so take this as an example.
The type of SQL we downloaded, please pay attention! It's MySQL Community Server, don't make a mistake! The wrong installation is wrong, and then the method of uninstalling will be another.
Drop down and select as follows
After that, all the things shown below meet the requirements, and then we select the three shown in the following figure:
The following 6, ah, don't bother ~ if you need it, of course, just use it ~ it's okay.
Good ~ the old way to download them down, don't say no! Wget that I taught before!
Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-devel-5.5.50-1.el7.x86_64.rpm
Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.50-1.el7.x86_64.rpm
Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.50-1.el7.x86_64.rpm
After the download is complete, install it in the order of server-> client-> devel!
The old way rpm-ivh MySQL-server-5.5.50-1.el7.x86_64.rpm
Pay attention here!
If your MySQL runs the above error! The content is roughly as follows:
Error: Failed dependencies:
Libaio.so.1 () (64bit) is needed by MySQL-server-5.5.50-1.el7.x86_64
Libaio.so.1 (LIBAIO_0.1) (64bit) is needed by MySQL-server-5.5.50-1.el7.x86_64
Libaio.so.1 (LIBAIO_0.4) (64bit) is needed by MySQL-server-5.5.50-1.el7.x86_64
That means your server does not have "dependency package libaio" installed.
Then let's install it!
Type yum install libaio directly to install, type the Y key halfway to agree with the god horse, continue to install so many things before the god horse, it is not strange to see ~ Y is.
Relevant information is also available on the Internet as follows:
When you run this command, you will find that you cannot quickly install software on this CVM through yum. After searching for some information, it turns out that Aliyun installed a 64-bit Red Hat5.4 system, but provided a 32-bit CentOS system. The error message is as follows:
Setting up Install Process
No package libaio available.
Nothing to do
Uh... Anyway, I did not encounter this situation during the installation, if you have encountered this situation, you might as well try it according to the following method.
(1) check which yum packages are available through the rpm command, and then uninstall them.
The operations performed by the author on the CVM are as follows:
[root@AY130221101729bc93912 software] # rpm-qa | grep yum
Yum-3.2.22-20.el5
Yum-metadata-parser-1.1.2-3.el5
[root@AY130221101729bc93912 software] # rpm-e-- nodeps yum-3.2.22-20.el5
Warning: / etc/yum.conf saved as / etc/yum.conf.rpmsave
[root@AY130221101729bc93912 software] # rpm-e-- nodeps yum-metadata-parser-1.1.2-3.el5
(2) download the yum package of CentOS on the 163image by wget command
The reference command is as follows:
Wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
Wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
Wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
Note: there may be some different versions. Please look under http://mirrors.163.com/centos/5/os/x86_64/CentOS/ for downloading rpm packages at the beginning of yum-3xxx, yum-metadata and yum-fastestmirror.
(3) install the rpm package related to yum
Install the rpm package downloaded in (2) using the following command:
Rpm-ivh yum-*
(4) download CentOS-Base.repo
Find a CentOS package resource configuration library, named CentOS-Base.repo, and put it in the / etc/yum.repos.d/ path:
[root@AY130221101729bc93912 software] # cd / etc/yum.repos.d/
[root@AY130221101729bc93912 yum.repos.d] # wget http://www.linuxidc.com/files/2011/05/06/CentOS-Base.repo
-- 2013-02-22 08 Fran 58 RV 27 muri-http://www.linuxidc.com/files/2011/05/06/CentOS-Base.repo
Resolving www.linuxidc.com 60.191.129.94
Connecting to www.linuxidc.com | 60.191.129.94 |: 80 connected.
HTTP request sent, awaiting response 200 OK
Length: 1426 (1.4K) [application/octet-stream]
Saving to: `CentOS-Base.repo'
1426 [= >] 100% [= >] 100% [= >] 1426 -.-Kmax s in 0s
2013-02-22 08:58:28 (124 MB/s)-`124 CentOS-Base.repo' saved [1426ax 1426]
(5) generate cache files to the / var/cache/yum directory
[root@AY130221101729bc93912 yum.repos.d] # yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
Addons | 1.9 kB 00:00
Addons/filelists_db | 568B 00:00
Addons/other_db
Base
…… 3641/3641
Base 3641/3641
Metadata Cache Created
(6) install the dependency package libaio
After the completion of step (5), you can successfully run the yum install libaio command at this time, referring to the execution as follows:
[root@AY130221101729bc93912 yum.repos.d] # yum install libaio
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
……
Complete
good! Once the above is done, we can continue to work on our MySQL and install them in the order in which we will
Rpm-ivh MySQL-server-5.5.50-1.el7.x86_64.rpm
Rpm-ivh MySQL-client-5.5.50-1.el7.x86_64.rpm
Rpm-ivh MySQL-devel-5.5.50-1.el7.x86_64.rpm
If you want to see which directory MySQL is installed in, use the "whereis mysql" command to see it, as shown in my figure below:
You can start MySQL using the following command:
Service mysql start
Or use the following command:
/ etc/init.d/mysql start
I generally prefer the latter ~ after all, most of the online seniors say that the latter is not easy to make mistakes.
After opening the database ~
If you are lucky, you will be prompted to set the root password when you run the MySQL command, which looks like the following words
[ERROR] You must SET PASSWORD before executing this statement
In this case, directly use SET PASSWORD = PASSWORD ('your password'); you can (remember the semicolon)
Of course, as soon as I try mysql-uroot-p login, I will report mysql "Access denied for user 'root'@'localhost'" error.
Ah ~ get used to it, the old man's learning road is bumpy, how can it be so smooth? no, no, no.
The problem is very simple, that is, the password is estimated to exist the default value or god horse, if not, do not give it!
Well, if you know the problem, the great gods on the Internet have also encountered these things a long time ago. There are many solutions. I choose what is useful to me and what I think is useful to you.
Method 1:
1. Close the database:
/ etc/init.d/mysql stop
2. Set the MySQL mode:
Mysqld_safe-user=mysql-skip-grant-tables-skip-networking &
You can imagine how horrible it is for others to access your server. )
3. Log in to MySQL:
Mysql-u root mysql
4. Change the password:
UPDATE user SET Password=PASSWORD ('new password') where USER='root'
5. Update:
FLUSH PRIVILEGES
6. Exit MySQL:
Quite
Method 2:
1. Query the password provided in the [client] section of the / etc/mysql/debian.cnf file
Vi / etc/mysql/debian.cnf
2. Use this password to log in
Mysql-uroot-p
Enter password: XXXXXXXXXX
good! Add here, when you use method-safe mode to go in to change the password, anything you do next in MySQL! This error will be reported:
What do you mean? Take a look at this, although it is pure English, but you can still see what you want: http://dev.mysql.com/doc/refman/5.6/en/alter-user.html, after reading it ~ do what it says ~
SET PASSWORD = PASSWORD ('same password as before')
And now it's really time to set your MySQL password! Here is a problem I encountered in developing Java Web. If you don't need it, you can skip it.
When my server was testing the project, I found the following problems:
Java.sql.SQLException: Your password has expired.To log in you must change it using a client that supports expired passwords. Com.mysql.jdbc.exception.
Then a lot of cant connect...cant connect, all talking about database connection problems, our MySQL installation is supposed to be no problem, that may be the right to use our root account, so we open the user table to have a look.
Use mysql
Select host,user,password_expired from user
After opening it, we found that several accounts in our table have expired (Y in the picture indicates that they have expired), so we can modify the content of the form Ymuri-> N and I will not knock the command.
It turns out that this really solves the connection problem ~ I can link to my MySQL through root ~
Later words
For different versions of Linux, there are a variety of ways to install mysql, which can be used for reference. If not mentioned above, you can also refer to other methods, such as
Install through the yum command
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.