linux服务器配置教程

来源:互联网 发布:淘宝新开店铺采集 编辑:程序博客网 时间:2024/06/05 11:31

整理的一份linux服务器配置教程


1、VPSMate安装

    1    # wget http://www.vpsmate.org/tools/install.py

    2    # python install.py


2、安装好了VPSMate后,还要安装IUS源,执行以下命令(注意版本):
    1    yum -y install gcc
    2    yum -y install gcc-c++
    3    rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/i386/ius-release-1.0-11.ius.el6.noarch.rpm                           (32位)

    4    rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm               (64位)


3、安装Mysql
    3.1手动
        wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.com
        wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.com
        wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.co
        rpm -ivh MySQL-server-5.6.10-1.rhel5.x86_64.rpm
        rpm -ivh MySQL-client-5.6.10-1.rhel5.x86_64.rpm

        rpm -ivh MySQL-devel-5.6.10-1.rhel5.x86_64.rpm


        如果有安装过程有文件冲突,先卸载原有文件
        yum -y remove mysql-libs-5*

        启动服务
        service mysql start


    3.2、使用VPSMate的“服务管理”安装“数据库服务”

        如果有安装过程有文件冲突,先卸载原有文件

        yum -y remove mysql-libs-5*


4、安装jre

下载:wget http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jre-8u5-linux-x64.rpm?AuthParam=1404923334_f3f295697f694911cb4d0848524df4df

安装:rpm -ivh jre-8u5-linux-x64.rpm
环境配置:

vi /etc/profile

!     (进入插入模式)

插入以下类容:

PATH:/usr/java/jre1.8.0_05 /bin
export JAVA_HOME =/usr/java/jre1.8.0_05
export CLASSPATH = $JAVA_HOME/lib:.

保存并退出esc+:wq

(不保存直接退出是:q!)

验证:java -version

5、安装tomcat

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.9/bin/apache-tomcat-8.0.9.tar.gz

tar -zxvf apache-tomcat-8.0.9.tar.gz

cp -R apache-tomcat-8.0.9 /usr/local/tomcat

/usr/local/tomcat/bin/startup.sh

测试:http://[IP地址]:8080/

手动启动tomcat:

cd /usr/local/tomcat/bin

./startup.sh


下一步:重置mysql密码:

4. 启动

[root@liuchao software] service mysql start

5. Mysql的默认密码

先查看.mysql_secret文件,最后面的串就是root的初始登陆密码(A1wCMNXo)
[root@liuchao ~]# cat /root/.mysql_secret
# The random password set for the root user at Fri Jun 27 03:22:55 2014 (local time): A1wCMNXo

6. 登陆

[root@liuchao ~]# mysql -uroot -p
Enter password: 这里输入上面的密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.10

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> 
mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql>

7. 提示修改密码才可以登陆


mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
修改密码
mysql> set password = password(‘123456‘);
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye


8. 修改完成之后再登陆


[root@liuchao ~]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


mysql> show databases;


9. Navicat 8 for MySQL 连接(报错,这是因为需要远程登陆授权)


1103 - Host ‘192.168.6.46‘ is not allowed to connection to this MySQL server


 


mysql -u root -p123456
mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘;
mysql>flush privileges;
然后退出重启一下mysql就行了


10. 授权的时候报错


在执行update user set host = ‘%‘ where user = ‘root‘;报错
mysql> update user set host = ‘%‘ where user = ‘root‘;
ERROR 1062 (23000): Duplicate entry ‘%-root‘ for key ‘PRIMARY‘
那就直接执行下面的命令
mysql>flush privileges;
然后退出重启mysql就行了


11. 重启mysql


[root@liuchao local]# service mysql restart
Shutting down MySQL....[ OK ]
Starting MySQL..[ OK ]


 12. 安装完mysql发现


A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in ‘/root/.mysql_secret‘.


You must change that password on your first connect,
no other statement but ‘SET PASSWORD‘ will be accepted.
See the manual for the semantics of the ‘password expired‘ flag.


Also, the account for the anonymous user has been removed.


In addition, you can run:


/usr/bin/mysql_secure_installation


which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.


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


The latest information about MySQL is available on the web at


http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com


New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings


MYSQL的默认配置文件在/usr/my.cnf并没有在/etc/my.cnf文件中


Centos6.5安装Mysql5.6.10


参考地址:http://www.bubuko.com/infodetail-730884.html


下一步:为tomcat设置管理员密码


Tomcat7.X安装完成以后并没有默认的管理帐户,所以如果你需要使用管理功能的话必须先增加一个管理帐户。 
 管理帐户配置文件位置为:conf/tomcat-users.xml,比如你要增加admin用户,密码为“123456”,那么在该文件最后加上 
<user username="admin" password="123456" roles="manager-gui"/>。其中的roles是指定的用户角色,你可以下面的几个角色中选择一个: 
manager-gui,manager-script,manager-jmx,manager-status 
admin-gui,admin-script 
对于Tomcat首页上面的三个按钮 
Server Status和Manager App需要manager-gui 
Host Manager需要admin-gui 
多个角色可以同时指定,中间用逗号分隔(出于安全性考虑,最好不要指定过多的角色,具体的内容帮助文档中有详细描述)。 











0 0
原创粉丝点击