learn的基本用法,Mac下Tomcat的安装与使用

日期:2019-11-13编辑作者:服务器

Linux下启动和停止apache服务,linuxapache

文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

本文使用的Linux系统为CentOS 7,下面将介绍apache服务的启动、关闭与设置。apache在CentOS 7中一般是默认安装的,而且服务名字为httpd

文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

文章作者:Tyan
博客:noahsnail.com | CSDN | 简书

1. 安装apache及查看相关配置

# apache安装命令

$ sudo yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package httpd-2.4.6-45.el7.centos.4.x86_64 already installed and latest version
Nothing to do


# 查看apache文件的位置

$ sudo find / -name httpd
/run/httpd
/etc/logrotate.d/httpd
/etc/sysconfig/httpd
/etc/httpd
/var/log/httpd
/var/cache/httpd
/usr/sbin/httpd
/usr/lib64/httpd
/usr/share/httpd
/usr/include/httpd
/usr/libexec/initscripts/legacy-actions/httpd

Apache配置文件位于/etc/httpd/conf,主要的配置文件是/etc/httpd/conf/httpd.conf, apache相关的配置信息都可以在这个文件中看到。

1. 下载Tomcat并解压

  • 首先下载Tomcat,这不必多说,下载地址为:http://tomcat.apache.org/

  • 解压Tomcat,例如作者下载的apache-tomcat-7.0.70.zip,直接解压即可,解压后得到apache-tomcat-7.0.70文件夹。

本文主要介绍scikit-learn中的交叉验证。

2. apache服务的启动与关闭

# 启动服务
$ sudo systemctl start httpd.service

# 查看服务
$ ps aux | grep httpd
root     *  0.3  0.0 220444  4956 ?        Ss   15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2492 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND

# 停止服务
$ sudo systemctl stop httpd.service

# 重启服务
$ sudo systemctl restart httpd.service

启动服务后,可以在外网通过服务器的IP地址访问。可以看到如下界面:

2. 启动Tomcat的相关配置

首先需要给Tomcat的bin目录下的sh文件赋予可执行权限,命令如下:

$ sudo chmod 755 ~/MyEclipse/apache-tomcat-7.0.70/bin/*.sh
  • Demo

3. 配置自己可以在外部访问的内容

可以在/var/www/html下创建一个软链接,链接到你想要在外部访问的内容,同时要修改要访问目录的权限。

$ sudo ln -s your_path/images /var/www/html
$ sudo chmod 755 images

注:需要确保images的所有父目录都有权限,同时images的路径应该是全路径。


0


0

查看评论

文章作者:Tyan 博客:noahsnail.com | CSDN | 简书 本文使用的Linux系统为CentOS 7,下面将介绍apache服务的启...

3. 启动和关闭Tomcat

启动和关闭Tomcat,即运行startup.sh,shutdown.sh文件有两种方式,命令如下:

  • 方法一:
# 启动Tomcat
$ cd MyEclipse/apache-tomcat-7.0.70/bin/
$ sh startup.sh
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
Tomcat started.

# 关闭Tomcat
$ sh shutdown.sh
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
  • 方法二:
# 启动Tomcat
$ ./startup.sh start
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
Tomcat started.

# 关闭Tomcat
$ ./shutdown.sh shutdown
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ]  { -help | start | stop }

4. 配置Tomcat

在启动Tomcat后,发现进入不了Manage APP,需要在Tomcat中配置用户名和密码,找到Tomcat目下的conf目录,编辑tomcat-users.xml,在<tomcat-users>标签下加入下面两行代码,即配置了Manage APP的用户名和密码为tomcat,tomcat:

<tomcat-users>
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
</tomcat-users>

至此,Tomcat就在Mac下配置完成了,能启动关闭,当然也可以在Manage APP中发布应用,也可以直接将应用放到Tomcat下的webapps目录下。

注:当然可以把Tomcat配置在环境变量中,这个可以自行Google或百度。

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
from sklearn.learning_curve import learning_curve
from sklearn.model_selection import cross_val_score 


# 加载数据集
digits = load_digits()
X = digits.data
y = digits.target
# 用SVM进行学习并记录loss
train_sizes, train_loss, test_loss = learning_curve(SVC(gamma = 0.001), 
                                                    X, y, cv = 10, scoring = 'neg_mean_squared_error',
                                                    train_sizes = [0.1, 0.25, 0.5, 0.75, 1])

# 训练误差均值
train_loss_mean = -np.mean(train_loss, axis = 1)
# 测试误差均值
test_loss_mean = -np.mean(test_loss, axis = 1)

# 绘制误差曲线
plt.plot(train_sizes, train_loss_mean, 'o-', color = 'r', label = 'Training')
plt.plot(train_sizes, test_loss_mean, 'o-', color = 'g', label = 'Cross-Validation')

plt.xlabel('Training data size')
plt.ylabel('Loss')
plt.legend(loc = 'best')
plt.show()
  • 结果

![image](文章作者:Tyan
博客:noahsnail.com | CSDN | 简书

本文主要介绍scikit-learn中的交叉验证。

  • Demo
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
from sklearn.learning_curve import learning_curve
from sklearn.model_selection import cross_val_score 


# 加载数据集
digits = load_digits()
X = digits.data
y = digits.target
# 用SVM进行学习并记录loss
train_sizes, train_loss, test_loss = learning_curve(SVC(gamma = 0.001), 
                                                    X, y, cv = 10, scoring = 'neg_mean_squared_error',
                                                    train_sizes = [0.1, 0.25, 0.5, 0.75, 1])

# 训练误差均值
train_loss_mean = -np.mean(train_loss, axis = 1)
# 测试误差均值
test_loss_mean = -np.mean(test_loss, axis = 1)

# 绘制误差曲线
plt.plot(train_sizes, train_loss_mean, 'o-', color = 'r', label = 'Training')
plt.plot(train_sizes, test_loss_mean, 'o-', color = 'g', label = 'Cross-Validation')

plt.xlabel('Training data size')
plt.ylabel('Loss')
plt.legend(loc = 'best')
plt.show()
  • 结果

![image](文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

本文主要介绍scikit-learn中的交叉验证。

  • Demo
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
from sklearn.learning_curve import learning_curve
from sklearn.model_selection import cross_val_score 


# 加载数据集
digits = load_digits()
X = digits.data
y = digits.target
# 用SVM进行学习并记录loss
train_sizes, train_loss, test_loss = learning_curve(SVC(gamma = 0.001), 
                                                    X, y, cv = 10, scoring = 'neg_mean_squared_error',
                                                    train_sizes = [0.1, 0.25, 0.5, 0.75, 1])

# 训练误差均值
train_loss_mean = -np.mean(train_loss, axis = 1)
# 测试误差均值
test_loss_mean = -np.mean(test_loss, axis = 1)

# 绘制误差曲线
plt.plot(train_sizes, train_loss_mean, 'o-', color = 'r', label = 'Training')
plt.plot(train_sizes, test_loss_mean, 'o-', color = 'g', label = 'Cross-Validation')

plt.xlabel('Training data size')
plt.ylabel('Loss')
plt.legend(loc = 'best')
plt.show()
  • 结果

澳门金莎娱乐网站 1

澳门金莎娱乐网站 ,image

)

本文由澳门金莎娱乐网站发布于服务器,转载请注明出处:learn的基本用法,Mac下Tomcat的安装与使用

关键词:

【澳门金莎娱乐网站】把nginx加入到系统服务,

三、Java运行环境之 cent os6.8 64位安装nginx,os6.8nginx 文章转载: 根据工作需要,现在需要安装nginx服务器,本来可以直...

详细>>

腾讯服务器部署Centos,java搭建阿里云服务器环境

java搭建阿里云服务器环境(java环境+mysql+tomcat)和部署 JavaWeb 项目到云服务器(十分详细),阿里javaweb 最近在做项目...

详细>>

Nextcloud搭建过程,Centos7的apache网站环境搭建wor

网盘不可信赖 那就自个儿搭建256TB的网盘呗 — Nextcloud搭建进度,256tbnextcloud 二零一四年网盘的日子倒霉过啊 一家家...

详细>>

修改yum源为国内源,CentOS配置本地yum源

CentOS配置本地yum源/Ali云yum源/163yuan源,并配置yum源的优先级,centos163yuan 1.概述       YUM(全名为 Yellow dog Updater,...

详细>>