Linux

1.介绍Linux

Linux,全称GNU/Linux,是一套免费使用和自由传播的类UNIX操作系统,其内核由林纳斯·本纳第克特·托瓦兹于1991年第一次释出,它主要受到Minix和Unix思想的启发,是一个基于POSIX和Unix的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的Unix工具软件、应用程序和网络协议。它支持32位64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。Linux有上百种不同的发行版,如基于社区开发的debianarchlinux,和基于商业开发的Red Hat Enterprise LinuxSUSEoracle linux等。

2.安装Linux[CentOS6.5、Ubuntu]

3.学习Linux命令

linux命令
[wxrj@wxrj-linux 桌面]$ cd   
//当前用户的目录
[wxrj@wxrj-linux ~]$  
//创建文件夹 mkdir 文件夹名称
[wxrj@wxrj-linux ~]$ mkdir  test
//创建文件 touch 文件名称
[wxrj@wxrj-linux ~]$ touch test.txt
[wxrj@wxrj-linux ~]$ ll
drwxrwxr-x. 2 wxrj wxrj 4096 4月 17 10:44 test
-rw-rw-r--. 1 wxrj wxrj    0 4月 17 10:43 test.txt
..............
例如:
drwxrwxr-x. 2 wxrj wxrj 4096 4月 17 10:44 test
第1列  d[文件夹]  -[文件]
第2,3,4列  -- 当前用户的操作权限 【r 读 w 写 x 可执行 - 没有权限】
第5,6,7列  -- 与当前用户同一组的其他用户的操作权限 【r 读 w 写 x 可执行 - 没有权限】
第8,9,10列 -- 与当前用户不在同一组的其他用户的操作权限 【r 读 w 写 x 可执行 - 没有权限】

修改权限的命令
chmod  777  test.txt
7--[111]--[2,3,4列 rwx]
7--[111]--[5,6,7列 rwx]
7--[111]--[8,9,10列 rwx]
-rwxrwxrwx. 1 wxrj wxrj    0 4月 17 10:43 test.txt
chmod  664  test.txt
6--[110]--[2,3,4列 rw-]
6--[110]--[5,6,7列 rw-]
6--[100]--[8,9,10列 r--]
-rw-rw-r--. 1 wxrj wxrj    0 4月 17 10:43 test.txt

删除文件夹 rm -rf 文件夹名称
[wxrj@wxrj-linux ~]$ rm -rf test
删除文件 rm -f 文件名称
[wxrj@wxrj-linux ~]$ rm -f test.txt

4.Linux卸载、安装JDK


linux CentOS6.5 安装 JDK
     
1、检查一下系统中的jdk版本
[wxrj@sxwx ~]$ java -version

2.检测jdk安装包
[wxrj@sxwx ~]$ rpm -qa | grep java

java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
tzdata-java-2013g-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64

3.卸载openjdk
  先切换用户到root
  [wxrj@sxwx ~]$ su root
  输入密码 
  [root@sxwx ~]# 

  [root@sxwx ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
  [root@sxwx ~]# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
  [root@sxwx ~]# rpm -e --nodeps tzdata-java-2013g-1.el6.noarch

4.之后再次输入rpm -qa | grep java 查看卸载情况:
   [root@sxwx ~]# rpm -qa | grep java

  [root@sxwx ~]# java -version
  bash: java: command not found

5.安装jdk-8u201-linux-x64.rpm
   切换用户到wxrj 
   [root@sxwx ~]# su wxrj
   [wxrj@sxwx ~]$ ll
    -rw-rw-r--. 1 wxrj wxrj   9672485 3鏈? 31 09:45 apache-tomcat-8.5.39.tar.gz
   -rw-rw-r--. 1 wxrj wxrj 176209195 3鏈? 31 09:42 jdk-8u201-linux-x64.rpm
   drwxr-xr-x. 2 wxrj wxrj      4096 3鏈? 28 12:09 鍏叡鐨?[0m
   drwxr-xr-x. 2 wxrj wxrj      4096 3鏈? 28 12:09 妯℃澘
   drwxr-xr-x. 2 wxrj wxrj      4096 3鏈? 28 12:09 瑙嗛
   ..........
   修改权限
   [wxrj@sxwx ~]$ chmod 777 jdk-8u201-linux-x64.rpm 
    [wxrj@sxwx ~]$ ll
    -rw-rw-r--. 1 wxrj wxrj   9672485 3鏈? 31 09:45 apache-tomcat-8.5.39.tar.gz
    -rwxrwxrwx. 1 wxrj wxrj 176209195 3鏈? 31 09:42 jdk-8u201-linux-x64.rpm
   drwxr-xr-x. 2 wxrj wxrj      4096 3鏈? 28 12:09 鍏叡鐨?[0m
   drwxr-xr-x. 2 wxrj wxrj      4096 3鏈? 28 12:09 妯℃澘
   drwxr-xr-x. 2 wxrj wxrj      4096 3鏈? 28 12:09 瑙嗛

   [wxrj@sxwx ~]$ su root
   输入密码 
   [root@sxwx wxrj]# rpm -ivh jdk-8u201-linux-x64.rpm
   warning: jdk-8u201-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
   Preparing...                ########################################### [100%]
   1:jdk1.8                 ########################################### [100%]
   Unpacking JAR files...
        tools.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...

      检查安装以后的jdk版本
[root@sxwx ~]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

  安装位置"/usr/java"

  配置环境变量
  
  切换到root
  [wxrj@sxwx ~]$ su root
   输入密码 

  进入根目录
  [root@sxwx ~] cd  /
  [root@sxwx /] cd etc
  [root@sxwx etc] vi profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`id -u`
        UID=`id -ru`
    fi
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
    pathmunge /sbin after
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null 2>&1
        fi
    fi
done

unset i
unset -f pathmunge=

输入"i"---编辑模式
在
export JAVA_HOME=/usr/java/javajdk1.7.0_01

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$JAVA_HOME/bin:$PATH

按Esc  输入“:wq”--保存并退出

  [root@sxwx etc] source profile  --生效

测试
[root@sxwx ~]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

5.Linux卸载、安装Eclipse


linux安装 eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
1.查看下载/上传的安装包
[wxrj@sxwx ~]$ ll
鎬荤敤閲?719124
drwxrwxr-x. 9 wxrj wxrj      4096 3鏈? 31 11:26 apache-tomcat-8.5.39
-rw-rw-r--. 1 wxrj wxrj   9672485 3鏈? 31 09:45 apache-tomcat-8.5.39.tar.gz
-rw-rw-r--. 1 wxrj wxrj  46307946 4鏈?  1 10:59 eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
-rwxrwxrwx. 1 wxrj wxrj 176209195 3鏈? 31 09:42 jdk-8u201-linux-x64.rpm
2.修改权限
[wxrj@sxwx ~]$ chmod 777 eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
[wxrj@sxwx ~]$ ll
鎬荤敤閲?719124
drwxrwxr-x. 9 wxrj wxrj      4096 3鏈? 31 11:26 apache-tomcat-8.5.39
-rw-rw-r--. 1 wxrj wxrj   9672485 3鏈? 31 09:45 apache-tomcat-8.5.39.tar.gz
-rwxrwxrwx. 1 wxrj wxrj 351457868 3鏈? 31 17:59 eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
-rwxrwxrwx. 1 wxrj wxrj 176209195 3鏈? 31 09:42 jdk-8u201-linux-x64.rpm

3.解压安装包
[wxrj@sxwx ~]$ tar  -zxvf eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
..........
eclipse/eclipse
eclipse/.eclipseproduct
eclipse/readme/
eclipse/readme/readme_eclipse.html
eclipse/dropins/
eclipse/eclipse.ini
eclipse/configuration/
eclipse/configuration/org.eclipse.equinox.simpleconfigurator/
eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
eclipse/configuration/config.ini
eclipse/configuration/org.eclipse.update/
eclipse/configuration/org.eclipse.update/platform.xml

4.查看解压文件
[wxrj@sxwx ~]$ ll
鎬荤敤閲?719128
drwxrwxr-x. 9 wxrj wxrj      4096 3鏈? 31 11:26 apache-tomcat-8.5.39
-rw-rw-r--. 1 wxrj wxrj   9672485 3鏈? 31 09:45 apache-tomcat-8.5.39.tar.gz
drwxrwxr-x. 8 wxrj wxrj      4096 3鏈? 15 02:39 eclipse
-rwxrwxrwx. 1 wxrj wxrj 351457868 3鏈? 31 17:59 eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
-rwxrwxrwx. 1 wxrj wxrj 176209195 3鏈? 31 09:42 jdk-8u201-linux-x64.rpm


创建桌面快捷方式
  右键桌面---创建启动器---类型:应用程序
                         名称:Eclipse
                         命令:/home/wxrj/eclipse/jee-none/eclipse/eclipse
                         注释:Eclipse-java ee

6.Linux卸载、安装MySQL

linux安装mysql数据库 

1.查看该操作系统上是否已经安装了mysql数据库
[wxrj@sxwx ~]$ rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64

3.卸载掉之前的mysql
   rpm -e mysql  // 普通删除模式
   rpm -e --nodeps mysql  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
  
例如:
[wxrj@sxwx ~]$ su root
输入密码
[root@sxwx wxrj]# 
[root@sxwx ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@sxwx ~]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
[root@sxwx ~]# rpm -qa | grep mysql
[root@sxwx ~]# 

4.通过yum来进行mysql的安装

1.我是通过yum的方式来进行mysql的数据库安装,首先我们可以输入 yum list | grep mysql 命令来查看yum上提供的mysql数据库可下载的版本:
[root@wxrj ~]# yum list | grep mysql
就可以得到yum服务器上mysql数据库的可下载版本信息:
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxx


2.我们可以通过输入 yum install -y mysql-server mysql mysql-devel 命令将mysql mysql-server mysql-devel都安装好(注意:安装mysql时我们并不是安装了mysql客户端就相当于安装好了mysql数据库了,我们还需要安装mysql-server服务端才行)
[root@wxrj ~]# yum install -y mysql-server mysql mysql-devel
 在等待了一番时间后,yum会帮我们选择好安装mysql数据库所需要的软件以及其它附属的一些软件.

3.查看刚安装好的mysql-server的版本
[root@wxrj ~]# rpm -qi mysql-server
我们安装的mysql-server并不是最新版本,如果你想尝试最新版本,那就去mysql官网下载rpm包安装就行了,至此我们的mysql数据库已经安装完成了。


4.我们在安装完mysql数据库以后,会发现会多出一个mysqld的服务,这个就是咱们的数据库服务,我们通过输入 service mysqld start 命令就可以启动我们的mysql服务。

注意:如果我们是第一次启动mysql服务,mysql服务器首先会进行初始化的配置,

[root@wxrj ~]# service mysqld start

初始化 MySQL 数据库: WARNING: The host 'xiaoluo' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h xiaoluo password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                          	       [确定]
正在启动 mysqld:                                            [确定]

5.这时我们会看到第一次启动mysql服务器以后会提示非常多的信息,目的就是对mysql数据库进行初始化操作,当我们再次重新启动mysql服务时,就不会提示这么多信息了,如:
[root@wxrj ~]# service mysqld restart
停止 mysqld:                                                [确定]
正在启动 mysqld:                                          [确定]



6.我们在使用mysql数据库时,都得首先启动mysqld服务,我们可以 通过  chkconfig --list | grep mysqld 命令来查看mysql服务是不是开机自动启动,如:
[root@wxrj ~]# chkconfig --list | grep mysqld
mysqld             0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
 

7.我们发现mysqld服务并没有开机自动启动,我们当然可以通过 chkconfig mysqld on 命令来将其设置成开机启动,这样就不用每次都去手动启动了
[root@wxrj ~]# chkconfig mysqld on
[root@wxrj ~]# chkconfig --list | grep mysql
mysqld             0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭


8.mysql数据库安装完以后只会有一个root管理员账号,但是此时的root账号还并没有为其设置密码,在第一次启动mysql服务时,会进行数据库的一些初始化工作,在输出的一大串信息中,我们看到有这样一行信息 :
/usr/bin/mysqladmin -u root password 'new-password'  // 为root账号设置密码

9.我们可以通过 该命令来给我们的root账号设置密码
(注意:这个root账号是mysql的root账号,非Linux的root账号)
[root@xiaoluo ~]# mysqladmin -u root password '123456'  // 通过该命令给root账号设置密码为 root
 
10.我们就可以通过 mysql -uroot -p123456 命令来登录我们的mysql数据库了

show databases;

use test;

show tables;

create table t_student(stuid int);

show tables;

drop table t_student;

exit;  ---退出mysql数据库

11 我们就可以通过[root@wxrj ~]# service mysqld stop 可以关闭mysql数据库服务。

7.Linux卸载、安装Tomcat

inux安装 apache-tomcat-8.5.39.tar.gz

1.查看apache-tomcat-8.5.39.tar.gz文件
[wxrj@sxwx ~]ll

2.解压apache-tomcat-8.5.39.tar.gz文件
[wxrj@sxwx ~]tar  -zxvf apache-tomcat-8.5.39.tar.gz

3.查看解压目录
[wxrj@sxwx ~]ll
  得到一个解压以后的apache-tomcat-8.5.39文件夹

4.进入apache-tomcat-8.5.39文件
[wxrj@sxwx ~]cd apache-tomcat-8.5.39
[wxrj@sxwx apache-tomcat-8.5.39]ll
   bin  lib  conf ......
5.启动
   [wxrj@sxwx ~]cd bin
   [wxrj@sxwx bin]./startup.sh 

启动完成

6.测试apache-tomcat-8.5.39
   打开浏览器输入“http://127.0.0.1:8080”成功打开页面

8.Linux中部署项目

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值