一。准备安装环境:
1.yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel libxml2-utils
xsltproc openssl-devel unixODBC unixODBC-devel unixODBC-bin gtk2 fop
没有
xsltproc这个包,实际是
libxslt,修正为:
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel libxml2-utils libxml2 libxslt openssl-devel unixODBC unixODBC-devel unixODBC-bin gtk2 fop
gtk2-devel binutils-devel
mesa-libGLU-devel
No package libxml2-utils available.
No package unixODBC-bin available.
2.安装jdk 1.8.0_144
3.下载wxWidgets-3.0.3.tar:
tar -jxvf wxWidgets-3.0.3.tar
cd wxWidgets-3.0.3
./configure
--with-opengl -enable-unicode -enable-debug
make && make install
安装wxWidgets报错:The development files for GTK+ were not found.
解决:
yum -y install gtk2-devel binutils-devel
安装
wxWidgets时,make报错: error: ‘g_signal_handlers_disconnect_by_data’ was not declared in this scope
解决:本次安装使用的是3.1.1开发版,换成3.0.4稳定版,pass!
执行下步安装,否则在配置otp时会报错
./configure
--with-opengl -enable-unicode -enable-debug
报错:OpenGL libraries not available
yum install mesa-libGLU-devel
二。下载,安装otp_src_20.0.tar.gz:
tar zxvf otp_src_20.0.tar.gz
cd otp_src_20.0
./configure --prefix=/usr/local/erlang --with-opengl --enable-debug --enable-unicode --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll
--without-javac
配置报错:jinterface : Java compiler disabled by user
环境变量加入:
export JRE_HOME=/usr/java/jdk1.8.0_144/jre
export CLASSPATH=.:/usr/java/jdk1.8.0_144/lib/dt.jar:/usr/java/jdk1.8.0_144/lib/tools.jar
具体路径根据find / -name dt.jar命令查询所得
如果老是提示
jinterface : Java compiler disabled by user,尝试去掉--without-javac
安装java运行环境不完全,导致在configure erlang时,虽然用了without-javac的选项,但还是总提示:jinterface : Java compiler disabled by user,这个原因就是虽然不用javac编译,但是,必须得有javac的编译环境。
测试
是否有javac的方式,是在
shell
终端,输入javac,如有相应的命令运用信息,就对了,如没有,请完全安装;如果输入javac有相应信息,尝试去掉--without-javac
如果报xsltproc is missing,yum又找不到安装包,参考如下方法安装:
http://www.sagehill.net/docbookxsl/InstallingAProcessor.html
Installing xsltproc on Linux
If you are running a recent vintage of Linux, there is a good chance you will already have xsltproc installed on your system. Try the following command to see if you do:
xsltproc -version
If that command fails, or if it reports an old version, you can install the files you need using the RPM packages. The RPM packages can be found using the following URLs:
http://rpmfind.net/linux/rpm2html/search.php?query=libxml2http://rpmfind.net/linux/rpm2html/search.php?query=libxslt
You need system administration privileges (root) to install packages. Then commands such as these should work:
rpm -Uv libxml2-2.6.27-1.i386.rpmrpm -Uv libxslt-1.1.20-1.i386.rpm
Then try
xsltproc -version
to see if it reports the new version number.
其实只需要执行下述安装即可:
yum install
libxml2
yum install libxslt
make && make install
测试Erlang是否安装成功,在命令行输入erl命令判断:
[root@dev31 otp_src_20.0]# erl
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.0 (abort with ^G)
1>
如果显示Erlang的版本信息并进入erlang命令窗口表示安装成功。
这里可能执行失败,需要执行/usr/local/erlang/bin/erl
配置:vi /etc/profile
ERL_HOME=/usr/local/erlang
export PATH=$PATH:$ERL_HOME/bin
生效:source /etc/profile
总结:Linux下要让Erlang能够使用wxWidgets,需要以下命令配置wxWidgets:
./configure --with-opengl --enable-debug --enable-unicode
三。RabbitMQ的配置:
1.下载,解压rabbitmq:
cd /home
下载参考:
http://www.rabbitmq.com/install-generic-unix.html
下载:rabbitmq-server-generic-unix-3.7.0.tar
解压:tar xvf rabbitmq-server-generic-unix-3.7.0.tar -C /home
mv rabbitmq-server-generic-unix-3.7.0 rabbitmq
2.配置环境变量:
然后在配置rabbitmq环境变量,vi /etc/profile文件,增加下面的环境变量:
#set rabbitmq environment
export PATH=$PATH:/home/rabbitmq/sbin
source /etc/profile使得文件生效
3.启动RabbitMQ:(以我的安装目录为例)
cd /home/rabbitmq/sbin 进入rabbitmq的sbin目录
./rabbitmq-server & 启动rabbitmq
./rabbitmqctl status 查看rabbitmq的运行状态信息
./rabbitmqctl stop 关闭rabbitmq
这里有个坑,启动报错:init terminating in do_boot
如果是windows环境,检查安装路径不能有空格;
linux,确认erl是你安装的版本,find / -name erl 查看都有哪些erl,我的操作:
[root@dev-51 rabbitmq]# mv /usr/local/bin/erl /usr/local/bin/erl.bak
[root@dev-51 rabbitmq]# cp /usr/local/erlang/bin/erl /usr/local/bin/erl
RabbitMQ的自启动配置
1.编写启动脚本 文件名为:rabbitmq
内容如下:(见rabbitmq文件)
2.配置自启动
cd /etc/rc.d/init.d 进入该目录
touch rabbitmq 创建脚本
chmod +x rabbitmq 修改脚本文件的权限
chkconfig --add rabbitmq 添加服务器
chkconfig --level 345 rabbitmq on 设置自启动
chkconfig --list rabbitmq 查看自启动项是否设置成功
3.启动服务:
service rabbitmq start 启动rabbitmq服务
service rabbitmq status 查看rabbitmq的状态
service rabbitmq restart 重启
reboot 重启机器验证是否自启动
重启后进入命令行 使用 ps aux|grep rabbitmq 或 service rabbitmq status 验证rabbitmq是否自启动成功。
启动过程可能报相关目录无权限,修改对应目录的权限或宿主
4. 配置网页插件
首先创建目录,否则可能报错:
mkdir /etc/rabbitmq
然后启用插件:
cd /home/rabbitmq/sbin/
./rabbitmq-plugins enable rabbitmq_management
配置linux 端口 15672 网页管理 5672 AMQP端口,然后访问http://localhost:15672即可 ,默认用户guest 密码guest
5. 远程访问配置
默认网页是不允许访问的,需要增加一个用户修改一下权限,代码如下:
cd /home/rabbitmq/sbin/
rabbitmqctl add_user test
test ---添加用户名:密码(
test:test )
rabbitmqctl set_user_tags
test administrator ---修改用户角色,设置
test 为管理员账户
rabbitmqctl list_permissions ---查看(指定vhost)所有用户的权限信息:
rabbitmqctl set_permissions
test '.*' '.*' '.*' ---设置对Vhost的配置,读和写的权限。
rabbitmqctl list_user_permissions
test ---查看指定用户的权限信息
rabbitmqctl clear_permissions guest ---清除用户guest的权限信息
然后就可以远程访问了,然后可直接配置用户权限等信息。
此时启动rabbitmq 访问界面http://192.168.2.31:15672/ 会进入到登录界面,如果linux系统开启了防火墙则需要设置端口开放.
cluster搭建起来后若在web管理工具中rabbitmq_management的Overview的Nodes部分看到“
Node statistics not available”的信息,说明在该节点上web管理插件还未启用。
直接在显示提示信息的节点上运行sudo rabbitmq-plugins enable rabbitmq_management即可。
Error: mnesia_unexpectedly_running
原因:忘记先停止stop_app
解决:sudo rabbitmqctl stop_app
若rabbitmq-server第一次启动后hostname不能被解析或者发生了更改则会导致启动失败
需执行如下操作
sudo rm -rf /var/lib/rabbitmq/mnesia(因为相关信息会记录在此数据库)
重装RabbitMQ Server
########################################
如果出现报错:
[root@dev31 sbin]# rabbitmqctl add_user
test
test
Error: unable to perform an operation on node 'rabbitmq@dev31'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbitmq@dev31
DIAGNOSTICS
===========
attempted to contact: [rabbitmq@dev31]
rabbitmq@dev31:
* connected to epmd (port 4369) on dev31
* epmd reports node 'rabbitmq' uses port 40000 for inter-node and CLI tool traffic
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
Current node details:
* node name: rabbitmqcli14@dev31
* effective user's home directory: /root
* Erlang cookie hash: fHaK+AChcr5e7TmqsIrmcg==
参考解决方法:
[root@dev31 sbin]# find / -name .erlang.cookie
/home/rabbitmq/.erlang.cookie
/root/.erlang.cookie
[root@dev31 sbin]# cp /home/rabbitmq/.erlang.cookie /root/.
cp:是否覆盖"/root/./.erlang.cookie"? y
[root@dev31 sbin]# rabbitmqctl add_user test test
Adding user "test" ...
用哪个用户启动rabbitmq,确保正确的.erlang.cookie在用户默认目录下;
如果服务启动脚本里面有配置RABBITMQ_HOME,复制.erlang.cookie到RABBITMQ_HOME;
如果是集群,建议统一使用主节点的.erlang.cookie,并确保文件权限为400
============================================
[root@dev31 ~]# cat /etc/rc.d/init.d/rabbitmq
#!/bin/sh
#
# rabbitmq-server RabbitMQ broker
#
# chkconfig: - 80 05
# description: Enable AMQP service provided by RabbitMQ
#
### BEGIN INIT INFO
# Provides: rabbitmq-server
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Description: RabbitMQ broker
# Short-Description: Enable AMQP service provided by RabbitMQ broker
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
export HOME=/home/rabbitmq ##自行配置对应目录
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/home/otp_src_20.0/bin ##自行配置对应目录
NAME=rabbitmq-server
DAEMON=/home/rabbitmq/sbin/${NAME} ##自行配置对应目录
CONTROL=/home/rabbitmq/sbin/rabbitmqctl ##自行配置对应目录
DESC=rabbitmq-server
USER=test ##启动用户,涉及到.erlang.cookie文件的存取地址
INIT_LOG_DIR=/var/log/rabbitmq ##非root启动时,此处可能涉及到权限修改
PID_FILE=/var/run/rabbitmq/pid ##非root启动时,此处可能涉及到权限修改
START_PROG="daemon"
LOCK_FILE=/var/lock/subsys/$NAME ##非root启动时,此处可能涉及到权限修改
test -x $DAEMON || exit 0
test -x $CONTROL || exit 0
RETVAL=0
set -e
[ -f /etc/default/${NAME} ] && . /etc/default/${NAME}
ensure_pid_dir () {
PID_DIR=`dirname ${PID_FILE}`
if [ ! -d ${PID_DIR} ] ; then
mkdir -p ${PID_DIR}
chown -R ${USER}:${USER} ${PID_DIR}
chmod 755 ${PID_DIR}
fi
}
remove_pid () {
rm -f ${PID_FILE}
rmdir `dirname ${PID_FILE}` || :
}
start_rabbitmq () {
status_rabbitmq quiet
if [ $RETVAL = 0 ] ; then
echo RabbitMQ is currently running
else
RETVAL=0
ensure_pid_dir
set +e
RABBITMQ_PID_FILE=$PID_FILE $START_PROG $DAEMON \
> "${INIT_LOG_DIR}/startup_log" \
2> "${INIT_LOG_DIR}/startup_err" \
0<&- &
$CONTROL wait $PID_FILE >/dev/null 2>&1
RETVAL=$?
set -e
case "$RETVAL" in
0)
echo SUCCESS
if [ -n "$LOCK_FILE" ] ; then
touch $LOCK_FILE
fi
;;
*)
remove_pid
echo FAILED - check ${INIT_LOG_DIR}/startup_\{log, _err\}
RETVAL=1
;;
esac
fi
}
stop_rabbitmq () {
status_rabbitmq quiet
if [ $RETVAL = 0 ] ; then
set +e
$CONTROL stop ${PID_FILE} > ${INIT_LOG_DIR}/shutdown_log 2> ${INIT_LOG_DIR}/shutdown_err
RETVAL=$?
set -e
if [ $RETVAL = 0 ] ; then
remove_pid
if [ -n "$LOCK_FILE" ] ; then
rm -f $LOCK_FILE
fi
else
echo FAILED - check ${INIT_LOG_DIR}/shutdown_log, _err
fi
else
echo RabbitMQ is not running
RETVAL=0
fi
}
status_rabbitmq() {
set +e
if [ "$1" != "quiet" ] ; then
$CONTROL status 2>&1
else
$CONTROL status > /dev/null 2>&1
fi
if [ $? != 0 ] ; then
RETVAL=3
fi
set -e
}
rotate_logs_rabbitmq() {
set +e
$CONTROL rotate_logs ${ROTATE_SUFFIX}
if [ $? != 0 ] ; then
RETVAL=1
fi
set -e
}
restart_running_rabbitmq () {
status_rabbitmq quiet
if [ $RETVAL = 0 ] ; then
restart_rabbitmq
else
echo RabbitMQ is not runnning
RETVAL=0
fi
}
restart_rabbitmq() {
stop_rabbitmq
start_rabbitmq
}
if [ ! -d $INIT_LOG_DIR ]; then
mkdir $INIT_LOG_DIR
fi
case "$1" in
start)
echo -n "Starting $DESC: "
start_rabbitmq
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
stop_rabbitmq
echo "$NAME."
;;
status)
status_rabbitmq
;;
rotate-logs)
echo -n "Rotating log files for $DESC: "
rotate_logs_rabbitmq
;;
force-reload|reload|restart)
echo -n "Restarting $DESC: "
restart_rabbitmq
echo "$NAME."
;;
try-restart)
echo -n "Restarting $DESC: "
restart_running_rabbitmq
echo "$NAME."
;;
*)
echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2
RETVAL=1
;;
esac
exit $RETVAL
=======================================
参考:
https://blog.csdn.net/u013256816/article/details/53524766
http://www.cnblogs.com/knowledgesea/p/6535766.html
https://blog.csdn.net/tengdazhang770960436/article/details/50009007
https://blog.csdn.net/WoogeYu/article/details/51119101