CentOS 7上部署asp.net MVC项目详细过程

一、Mysql安装:

之前在CentOS 7上安装Mysql一直装不上,查了一下才知道已经改用MariaDB代替了

1.删除原来的MariaDB、重装

1
2
[[email protected] ~]# yum remove mariadb
[[email protected] ~]# yum -y install mariadb

2.启动MariaDB

1
[[email protected] ~]# systemctl start mariadb.service

如果没问题说明已经安装成功,本人到这步的时候数据库启动报错(成功请忽略,直接跳到下一步),

2.1 查看启动状态

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[[email protected] ~]# systemctl status mariadb -l

mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
Active: failed (Result: exit-code) since Wed 2015-01-07 22:47:01 EST; 9s ago
Process: 19037 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 19036 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 19009 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 19036 (code=exited, status=0/SUCCESS)

Jan 07 22:47:00 JX-Store systemd[1]: Starting MariaDB database server...
Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Jan 07 22:47:01 JX-Store systemd[1]: mariadb.service: control process exited, code=exited status=1
Jan 07 22:47:01 JX-Store systemd[1]: Failed to start MariaDB database server.
Jan 07 22:47:01 JX-Store systemd[1]: Unit mariadb.service entered failed state

解决办法:删除/var/lib/mysql 和 /etc/my.cnf 重新安装

3.登陆

MariaDB的操作命令跟Mysql一样

1
2
3
4
5
6
#可以通过以下命令查看版本,确认MariaDB已安装成功
[[email protected] ~]# mysql --version
#可以通过 MariaDB 命令行登录,然后对数据库进行sql查询操作
[[email protected] ~]# mysql -uroot -pyourpassword
# 开放防火墙端口,开启后要重启防火墙
[[email protected] ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent

第一次安装会默认给你配置一个密码,可以搜一下怎么登陆

二、Jexus和Mono的安装配置可参照

CentOS 6.6上部署asp.net MVC项目详细过程

三、一些常见问题及操作

1.Jexus 大小写敏感解决:

cd /usr/jexus/
vim jws
将#export MONO_IOMAP=”all”前面的“#”去掉!
重启Jexus服务: /usr/jexus/jws restart

2.Centos7 下mysql大小写敏感:

编辑/etc/my.cnf文件,在[mysqld]节下 添加 lower_case_table_names=1 参数,并设置相应的值 (备注:为0时大小写敏感,为1时大小写不敏感,默认为0)。(必须是在[mysqld]节点下添加,否则没有效果),
重启mariadb:systemctl restart mariadb.service

3.防火墙设置

1
2
3
4
5
6
7
8
9
10
# 关闭防火墙
[[email protected] ~]# systemctl stop firewalld.service
# 禁止firewall开机启动
[[email protected] ~]# systemctl disable firewalld.service
# 开启端口
[[email protected] ~]# firewall-cmd --zone=public --add-port=1235/tcp --permanent
# 重启防火墙
[[email protected] ~]# firewall-cmd --reload
# 查看已经开放的端口:
[[email protected] ~]# firewall-cmd --list-ports