Linux常用软件安装

1. 大纲

  • 1.1. 熟练使用Linux常用命令

  • 1.2. 熟练修改Linux的基本配置

  • 1.3. 熟练在Linux上安装JDK、Tomcat、MySQL软件

2. 修改Linux的基本配置

  • 1.修改主机名

    vi /etc/sysconfig/network
    
    NETWORKING=yes
    
    HOSTNAME=server1
    
  • 2.修改ip地址

    vi /etc/sysconfig/network-scripts/ifcfg-eth0
    
    DEVICE=eth0
    
    TYPE=Ethernet
    
    ONBOOT=yes
    
    BOOTPROTO=static
    
    IPADDR=192.168.0.101
    
    NETMASK=255.255.255.0
    
    service network restart
    
  • 3.修改ip地址和主机名的映射关系

    vi /etc/hosts
    
    127.0.0.1   localhost localhost.localdomain localhost4       localhost4.localdomain4
    
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    
    192.168.0.101 server1
    
  • 4.关闭iptables并设置其开机启动/不启动

    service iptables stop
    
    chkconfig iptables on
    
    chkconfig iptables off
    

3. 安装JDK

  • 1.上传jdk-7u45-linux-x64.tar.gz到Linux上

  • 2.解压jdk到/usr/local目录

    tar -zxvf jdk-7u45-linux-x64.tar.gz -C /usr/local/
    
  • 3.设置环境变量,在/etc/profile文件最后追加相关内容

    vi /etc/profile
    
    export JAVA_HOME=/usr/local/jdk1.7.0_45
    
    export PATH=$PATH:$JAVA_HOME/bin
    
  • 4.刷新环境变量

    source /etc/profile
    
  • 5.测试java命令是否可用

    java -version
    

4. 安装Tomcat

  • 1.上传apache-tomcat-7.0.68.tar.gz到Linux上

  • 2.解压tomcat

    tar -zxvf apache-tomcat-7.0.68.tar.gz -C /usr/local/
    
  • 3.启动tomcat

    /usr/local/apache-tomcat-7.0.68/bin/startup.sh
    
  • 4.查看tomcat进程是否启动

    jps
    
  • 5.查看tomcat进程端口

    netstat -anpt | grep 2465
    
  • 6.通过浏览器访问tomcat

    http://192.168.0.101:8080/
    

5. 安装MySQL

  • 1.上传MySQL-server-5.5.48-1.linux2.6.x86_64.rpm、MySQL-client-5.5.48-1.linux2.6.x86_64.rpm到Linux上

  • 2.使用rpm命令安装MySQL-server-5.5.48-1.linux2.6.x86_64.rpm

    rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm
    
  • 3.安装perl依赖,上传6个perl相关的rpm包

    rpm -ivh perl-*
    
  • 4.再安装MySQL-server,rpm包冲突

      rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm
    
  • 5.卸载冲突的rpm包

    rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps
    
  • 6.再安装MySQL-client和MySQL-server

    rpm -ivh MySQL-client-5.5.48-1.linux2.6.x86_64.rpm
    
    rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm
    
  • 7.启动MySQL服务,然后初始化MySQL

    service mysql start
    
    /usr/bin/mysql_secure_installation
    
  • 8.测试MySQL

      mysql -u root -p

你可能感兴趣的:(Linux常用软件安装)