zoukankan      html  css  js  c++  java
  • 在Centos7.2(64位)下搭建Web服务器

     一:通过Yum安装mysql

    1 # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
    2 # rpm -ivh mysql-community-release-el7-5.noarch.rpm
    3 # yum install mysql-community-server

     

    二:重启mysql,并设置密码

    1 # service mysqld restart
    2 # mysql -u root 
    3 # set password for 'root'@'localhost' =password('password');
    4 
    5 systemctl status mysqld 查看mysql状态
    6 
    7 systemctl start mysqld 启动mysql
    8 
    9 systemctl stop mysqld 关闭mysql

     

    三:mysql远程连接设置

    1 mysql> grant all privileges on *.* to root@'%'identified by 'password';(把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户。)
    2 
    3 注:如果不是root用户,可先新建用户  mysql>create user 'username'@'%' identified by 'password';  (然后通过grant来进行给予权限)

     

    四:安装设置ftp

    安装

    1 yum install vsftpd

    修改/etc/vsftpd/vsftpd.config

    1 # 禁止匿名登陆
    2 anonymous_enable=NO
    3 # 限制访问自身目录
    4  chroot_list_enable=YES
    5 # (default follows)
    6 chroot_list_file=/etc/vsftpd/vsftpd/chroot_list 
    保存,重启ftp
    1 systemctl restart vsftpd

     

    五:安装jdk环境
     
    下载jdk的途径
    1、使用ftp上传本地下载的jdk
    2、使用scp命令上传
    scp /path/filename username@servername:/path/

    3、wget下载 (需要指定cookie,确认协议的)

    1 wget --no-cookie --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz

    下载好,解压到 /root/java

    然后配置环境,在/etc/profile文件的最下面添加

     

    然后重新加载profile

    1 source /etc/profile

     

    六:安装tomcat

     将tomcat解压好,将web程序放入webapps中,修改conf中的server.xml文件

    将端口改为80端口

    添加上面选中的语句,指定项目路径

     

    七:除了tomcat,使用spring boot的

    1 nohup java -jar message-1.0-SNAPSHOT.jar & > log.file 2>&1 &

     

    八:设置防火墙

    firewall-cmd --zone=public --add-port=80/tcp --permanent

    firewall-cmd --zone=public --add-port=3306/tcp --permanent

    firewall-cmd --zone=public --add-service=ftp --permanent

    systemctl enable firewalld.service             //开机启动

    systemctl restart firewalld.service    //重启防火墙

     

  • 相关阅读:
    设计模式--4建造者模式
    java中的方法重载与重写以及方法修饰符
    设计模式--3.模板方法模式
    设计模式--2.工厂方法模式
    设计模式--1.单例模式
    问题--时景某些用户不能发表评论解决方案
    EXCEL:从一组数据中查找我想要的某个数据是否存在
    Git版本控制--05--可以吃后悔药之版本回退
    Git版本控制--04--文件修改后怎么提交
    Git版本控制--03--怎么向Git仓库中添加文件
  • 原文地址:https://www.cnblogs.com/dj3839/p/6265948.html
Copyright © 2011-2022 走看看