Linux下的源码安装服务,配置服务为系统服务启动
下面的例子以源码安装MySQL为例子
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf //复制源码包下面的my-medium.cnf文件到、etc/my.cnf
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld //加到系统启动服务里面
chkconfig --level 35 mysqld on //设置为开机启动
/etc/init.d/mysqld restart
useradd mysql;//添加服务的用户
chown -R mysql:mysql /usr/local/mysql //给所属组
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=./var --basedir=/usr/local/mysql/ //对数据库进行初始化
chown -R mysql.mysql var
/usr/local/mysql/bin/mysqld_safe --user=mysql &