欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > linux >内容正文

linux

阿里云linux服务器初步使用

发布时间:2025/3/15 linux 29 豆豆
生活随笔 收集整理的这篇文章主要介绍了 阿里云linux服务器初步使用 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

tomcat 安装

进到/usr/local/apache执行命令 

wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz

然后解压

tar-zxvf apache-tomcat-7.0.57.tar.gz

查看

[root@iZ94l1n0y28Z apache]# ls

apache-tomcat-7.0.57  apache-tomcat-7.0.57.tar.gz

[root@iZ94l1n0y28Z apache]# cd apache-tomcat-7.0.57

[root@iZ94l1n0y28Z apache-tomcat-7.0.57]# ls

bin   lib      logs    RELEASE-NOTES  temp     work

conf  LICENSE  NOTICE  RUNNING.txt    webapps

[root@iZ94l1n0y28Z apache-tomcat-7.0.57]# 

tomcat 启动  

切换到tomcat 的bin路径下执行 ./startup.sh

tomcat 关闭

 ./shutdown.sh


查看tomcat运行实时日记

切换到tomcat的logs目录下

运行 

tail -f catalina.out




jdk安装

[root@iZ94l1n0y28Z local]# mkdir java

[root@iZ94l1n0y28Z local]# ls

aegis   bin  games    java  lib64    sbin   src

apache  etc  include  lib   libexec  share

[root@iZ94l1n0y28Z local]# cd java

[root@iZ94l1n0y28Z java]# wget http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.tar.gz

解压jdk  

然后一直不行。

最后直接在window下,下载好文件 然后通过ssh传到阿里云服务器

下载地址

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

如图

这次终于解压成功!

解压后

配置环境变量

     vi /etc/profile

    export JAVA_HOME = /usr/local/java/jdk1.7xxx
    export PATH = $JAVA_HOME/bin:$PATH

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

注意这里:

export JAVA_HOME=/usr/local/java/jdk1.7.0_71

export PATH=$JAVA_HOME/bin:$PATH

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


=号左右2边不要有空格不然启动时候报这个错:-bash: export: `=': not a valid identifier


mysql安装

mysql安装花了我比较多的时间

要安装的有3个

MySQL-server-5.0.96-1.glibc23.x86_64.rpm

MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

MySQL-client-5.0.96-1.glibc23.x86_64.rpm


一开始执行# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm的时候抛下面的错误

   MySQL conflicts with mysql-5.1.73-3.el6_5.x86_64



[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

解决方案:

要装这个

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm


安装server的时候遇到这个问题:

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

        MySQL conflicts with mysql-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -qa | grep -i libs | grep -i mysql

mysql-libs-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -e mysql-libs-5.1.73-3.el6_5.x86_64

error: Failed dependencies:

        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        libmysqlclient.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-


6.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        libmysqlclient_r.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient_r.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        mysql-libs = 5.1.73-3.el6_5 is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -e mysql-libs

error: Failed dependencies:

        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        libmysqlclient.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-


6.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        libmysqlclient_r.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient_r.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        mysql-libs = 5.1.73-3.el6_5 is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

        MySQL conflicts with mysql-5.1.73-3.el6_5.x86_64


后来找到方法就是:将系统预装的删除掉

[root@iZ94l1n0y28Z mysql]# yum -y remove mysql-libs-5.1.73-3.el6_5.x86_64

删除掉之后遇到了下面的问题

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

找到解决方法就是如下安装这个:

[root@iZ94l1n0y28Z mysql]# wget http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-shared-


compat-5.0.96-1.glibc23.x86_64.rpm

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-shared-compat    ########################################### [100%]

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-server           ########################################### [100%]

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 iZ94l1n0y28Z 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.


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

Starting MySQL. SUCCESS! 

[root@iZ94l1n0y28Z mysql


这个时候还不可以用MySQL命令行

还得安装MySQL-client-5.0.96-1.glibc23.x86_64.rpm


总而言之要将原来系统自带的干掉

然后按照这个顺序分别安装,至于其他顺序我没试过

MySQL-server-5.0.96-1.glibc23.x86_64.rpm

MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

MySQL-client-5.0.96-1.glibc23.x86_64.rpm


上面3个资源路径如下:

路径分别是

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-server-5.0.96-1.glibc23.x86_64.rpm

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-client-5.0.96-1.glibc23.x86_64.rpm 


连接数据库

[root@iZ94l1n0y28Z mysql]# mysql -u root 




设置数据库编码


/usr/share/doc/mysql-server-xxxx中的my-large.cnf复制到/etc/my.cnf

先通过vi 打开 my-large.cnf(i进入编辑模式,按esc退出编辑模式,按:wq退出并且保存该文件)


# Example MySQL config file for large systems.

#

# This is for a large system with memory = 512M where the system runs mainly

# MySQL.

#

# You can copy this file to

# /etc/my.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options (in this

# installation this directory is /var/lib/mysql) or

# ~/.my.cnf to set user-specific options.

#

# In this file, you can use all long options that a program supports.

# If you want to know which options a program supports, run the program

# with the "--help" option.


# The following options will be passed to all MySQL clients

[client]

#password       = your_password

port            = 3306

socket          = /var/lib/mysql/mysql.sock


# Here follows entries for some specific programs


# The MySQL server

[mysqld]

port            = 3306

socket          = /var/lib/mysql/mysql.sock

skip-locking

key_buffer = 256M

max_allowed_packet = 1M

table_cache = 256

sort_buffer_size = 1M

read_buffer_size = 1M

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size= 16M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8



2. 打开my.cnf,修改编码(注意:my.cnf是为了设置全局变量?可以将上面的内容复制到这个文件之后再改下面的)

    在[client]下,增加default-character-set=utf8

在[mysqld]下增加default-character-set=utf8 和 init_connect='SET NAMES utf8'

参考文章:

  • 如何远程连接阿里云主机服务器(Linux系统)

  • Linux下Tomcat的安装配置

  • 阿里云 安装 tomcat

  • vi 使用规则

  • mysql-5.1.60-linux-x86_64-glibc23 安装

  • 在阿里云Linux服务器上安装MySQL

  • 阿里云centos6.5安装 mysql

  • 【MySQL案例】mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package Perco

  • libmysqlclient.so.15()(64bit) is needed by perl-DBD-MySQL-3.0007-2.el5.x86_64的解决方法

  • 在阿里云Linux服务器上安装MySQL

  • MySQL远程访问权限,允许远程连接的开启

  • Linux 删除文件夹和文件的命令

  • linux下打开、关闭tomcat,实时查看tomcat运行日志

  • linux下mysql的远程连接




  • 转载于:https://my.oschina.net/liangzhenghui/blog/347976

    总结

    以上是生活随笔为你收集整理的阿里云linux服务器初步使用的全部内容,希望文章能够帮你解决所遇到的问题。

    如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。