Simple process of reinstalling linuxserver

         Project development is a very important part of software development, and it is also very necessary to have a safe and healthy server to make the system execute normally and efficiently. Because it is a server built on the Internet. From time to time, I will be attacked by various viruses. This blog does not write about how to defend against various viruses, but talks about it. Suppose this happens. How to solve the problem by reinstalling the server in the most stupid way, here is the process precautions.

 

         A project has gone live and this has happened. Under normal circumstances, we will be reloaded within a limited time at night and return to the original state. We need to prepare in advance to ensure that it can be completed. Well take a look here. Various matters that we need to consider before and after reinstalling the server. and simple practices.

 

         One, the first is the database backup, in a running System . The data in the database is the most important, so before doing any operations, back up the database first. Here is an example of mysql :

                  Functions provided by mysql . Export the database as a sql script:

                 Command: mysql dump -u username -p database > database.sql

        Demonstration example: mysqldump -u root -p db1>dbq.sql ( backup database db1 to db1.sql) . You are prompted to enter a password and you are done.

 

         two. Back up the running System :

                Find under web apps in tomcat , compress the project being executed, and download it.

 

         Third, back up the software such as tom cat and jdk in the server , or record the corresponding version number and download it. Installation and use, due to the stable implementation of the version number configuration of the project software, must also play an important role. and. mysql , nginx, memcached , etc. can be installed online.

 

         Fourth, cut the plate. do the system.

Here, you can format the original system and hard disk through win PE , and reset everything to zero. PE can be made with Chinese cabbage and Lao Mao Tao.

Let’s briefly talk about the linux system here. The linux system is often used as a server, including ubuntu and Red Hat . Here, let’s talk about ubuntu , which are generally divided into server versions: ubuntu-12.04.4-server-amd64 and desktop version ubuntu-12.04-desktop- amd64 , you can go to the corresponding official website to download the program, and then use the " ImageWriter " similar to Chinese cabbage, Lao Mao Tao's production tool to make a linux boot disk, very easy.

 

        Fifth, the installation of linux system: In fact, the installation of linux is almost the same as that of windos , the time and the user. network settings, etc. Just take a look at this webpage here, the specific process is no longer written: http://www.dedecms.com/knowledge/servers/linux-bsd/2012/0819/8387.html

 

       six. After the system is installed, start to install various software, first look at the installation of JDK . Here I focus on writing the configuration of environment variables that need to be paid attention to:

  1. 下载jdk:版本号jdk-7u45-linux-x64.tar.gz 并将JDK安装到 /usr/lib/jvm/文件夹
  2. 进入到安装文件夹:cd /usr/lib/jvm/
  3. 将压缩文件复制到此文件夹:sudo cp ~/jdk-7u45-linux-x64.tar.gz  ./
  4. 执行解压:sudo tar zxf  ./jdk-7u45-linux-x64.tar.gz
  5. 解压完毕。文件夹为 jdk-7u45-linux-x64
  6. 然后改动文件夹名字:mv  ./jdk1.7.0_45  ./jdk1.7

 

()设置优先级

 

==>输入:java version

 

显示内容:

java version "1.7.0_45"

 

OpenJDK Runtime Environment (IcedTea6 1.8)(6b18-1.8-ubuntu)

OpenJDK Client VM (build 14.0-b16 mixd mode sharing)

 

可见,系统中有两个JVM实现。并且OpenJDK JVM还被其他的Ubuntu工具或软件使用;

 

可使用“update-alternative“工具完毕程序多版本号实现:

sudo update-alternatives --display java

 

改动jdk 优先级别,命令例如以下:

update-alternatives --install /usr/bin/javajava /usr/lib/jvm/SunJDK/jdk1.6.0_38/bin/java 60   (代表权重)

update-alternatives --install /usr/bin/java java/usr/lib/jvm/java-6-openjdk/jre/bin/java 40

 

  1. 变量设置(需重新启动)

编辑文件:sudo vi/etc/profile。在最后一行粘贴例如以下内容:

export JAVA_HOME=/usr/lib/jvm/jdk1.7

export JRE_HOME=/usr/lib/jvm/jdk1.7/jre

exportCLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

export CATALINA_HOME=/opt/apache-tomcat

 

 

         七。tomcat的安装和配置:

                1,进入安装文件夹:cd  /opt

       2,apache-tomcat-6.0.37.tar.gz复制到当前文件夹,并解压,同一时候改变文件名称为:apache-tomcat,命令例如以下:

                   sudo cp ~/apche-tomcat-6.0.37.tar.gz ./

        sudo tar zxf./apache-tomcat-6.0.37.tar.gz ./

        sudo mv ./apache-tomcat-6.0.37apache-tomcat

       3,赋予当前用户及组datiba隶属权,及控制权

        chown -R 当前用户:当前用户 ./apache-tomcat

        chmod -R 744 ./apache-tomcat

  

         八,mysql,nginxmemcached等能够进行在线安装,

                    sudo apt-get install mysql-servernginx,memcached等),安装后须要依据项目的须要,改动相应的參数/etc/mysql/my.cnf,nginx.conf,memcached.conf等。

 

        九,剩下就是数据库数据的恢复,和项目的部署公布了,能够看看前边博客。

 

         这里主要写了一个流程,对具体细节写的不是非常具体。我们能够通过网络来帮助我们这些工作怎么做。

在做一件事前,我们要考虑好,顾全大局,一步步踏踏实实。稳步向前。

Guess you like

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