Linux基本配置

目录

1.安装jdk

2.yum 安装Nginx

3.yum 安装Redis

4.开启防火墙(开放端口)


1.安装jdk

  1. 解压jdk安装包
    # 解压
    tar -zxvf jdk-8u271-linux-x64.tar.gz
    # 修改解压后的文件名称为jdk1.8
    mv xxx/ jdk1.8
    
  2. 配置环境变量
    vim /etc/profile
    # 在最后边加
    # JAVA环境变量
    JAVA_HOME=/xxx/xxx/xxx
    PATH=$JAVA_HOME/bin:$PATH
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export JAVA_HOME
    export PATH
    export CLASSPATH
    
  3. 测试是否安装成功
    [root@VM-8-4-centos java]# javac
    Usage: javac <options> <source files>
    where possible options include:
      -g                         Generate all debugging info
      -g:none                    Generate no debugging info
      -g:{lines,vars,source}     Generate only some debugging info
      -nowarn                    Generate no warnings
      -verbose                   Output messages about what the compiler is doing
      -deprecation               Output source locations where deprecated APIs are used
      -classpath <path>          Specify where to find user class files and annotation processors
      -cp <path>                 Specify where to find user class files and annotation processors
      -sourcepath <path>         Specify where to find input source files
      -bootclasspath <path>      Override location of bootstrap class files
      -extdirs <dirs>            Override location of installed extensions
      -endorseddirs <dirs>       Override location of endorsed standards path
      -proc:{none,only}          Control whether annotation processing and/or compilation is done.
      -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process
      -processorpath <path>      Specify where to find annotation processors
      -parameters                Generate metadata for reflection on method parameters
      -d <directory>             Specify where to place generated class files
      -s <directory>             Specify where to place generated source files
      -h <directory>             Specify where to place generated native header files
      -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
      -encoding <encoding>       Specify character encoding used by source files
      -source <release>          Provide source compatibility with specified release
      -target <release>          Generate class files for specific VM version
      -profile <profile>         Check that API used is available in the specified profile
      -version                   Version information
      -help                      Print a synopsis of standard options
      -Akey[=value]              Options to pass to annotation processors
      -X                         Print a synopsis of nonstandard options
      -J<flag>                   Pass <flag> directly to the runtime system
      -Werror                    Terminate compilation if warnings occur
      @<filename>                Read options and filenames from file
    
  4. 查看版本
    [root@VM-8-4-centos java]# java -version
    java version "1.8.0_202"
    Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
    Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

2.yum 安装Nginx

  1. 查看gcc版本
    gcc -v
  2. gcc安装命令
    yum -y install gcc
    
  3. 安装openssl
    # openssl是web安全通信的基石,没有openssl,可以说我们的信息都是在裸奔。。。。。。
    yum install -y openssl openssl-devel
    
  4. 安装nginx
    yum install -y nginx
    
  5. 启动并设置开机自启
    sudo systemctl start nginx
    sudo systemctl enable nginx
    

3.yum 安装Redis

  1. 安装redis
     yum install -y redis
  2. 设置redis远程连接和密码
    /etc/redis.conf
    bin 127.0.0.1 注释掉,否则只有本地才能访问
    
    #bin 127.0.0.1
    保护模式
    protected-mode yes 改为
    protected-mode no
    要想修改端口号
    修改port即可
    修改密码
    requirepass 123456
  3. 启动redis
    #启动
    systemctl start redis
    #重启
    systemctl restart redis
    #查看状态
    systemctl status redis
    
  4. 开放端口号
    firewall-cmd --zone=public --add-port=6379/tcp --permanent
    #重新加载
    firewall-cmd --reload
  5. 本地连接redis
    [root@VM-8-4-centos ~]# redis-cli -h 127.0.0.1 -p 6379
    127.0.0.1:6379> auth 123456
    OK
    127.0.0.1:6379> 
  6. 查看redis版本
    redis-server -v

4.开启防火墙(开放端口)

  1. 开启防火墙

    systemctl start firewalld.service  
    
  2. 关闭防火墙

    systemctl stop firewalld.service
    
  3. 重启防火墙

    systemctl restart firewalld
  4. 开启端口

    firewall-cmd --zone=public --add-port=80/tcp --permanent
    #重新加载
    firewall-cmd --reload
    
  5. 查看已开放的端口

    firewall-cmd --list-ports
    

5.安装nodejs、npm

  1.  yum下载

    [root@VM-8-4-centos home]# yum install nodejs
    [root@VM-8-4-centos home]# yum install npm
  2. 检查版本

    [root@VM-8-4-centos home]# node -v
    v16.18.1
    [root@VM-8-4-centos home]# npm -v
    8.19.2
    
  3. npm阿里云镜像源加速

    [root@VM-8-4-centos home]# npm config set registry "https://registry.npm.taobao.org"
    #验证npm设置阿里云源是否设置成功
    [root@VM-8-4-centos home]# npm config get registry
    https://registry.npm.taobao.org/
    

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值