Fedora 18 安装配置

1添加教育网源

(1)

cd /etc/yum.repos.d/

(2)

sudo vi sjtu.repo
[Fedora-ftp.sjtu.edu.cn]
name=Fedora 18 –  x86_64
baseurl=http://ftp.sjtu.edu.cn/fedora/linux/releases/18/Fedora/x86_64/os/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
[Everything-ftp.sjtu.edu.cn]
name=Everything 18 – x86_64
baseurl=http://ftp.sjtu.edu.cn/fedora/linux/releases/18/Everything/x86_64/os/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
[updates-ftp.sjtu.edu.cn]
name=Fedora updates
baseurl=http://ftp.sjtu.edu.cn/fedora/linux/updates/18/x86_64/
enabled=1
gpgcheck=0

注意,本次安装的是fedora18x86_64系统,如果是32位系统则将x86_64换位i386即可,全换。

如果所在用户尚未成为sudoers则请进入root用户

su
vi /etc/sudoers

在root用户下面添加一行

yourusername   ALL=(ALL)       ALL

然后退出,重启一下,这样常用用户名就拥有了超级用户的所有权限了。

2测试添加的源

安装vim

由于本人习惯使用vim,所以下面就安装vim编辑器。

yum install vim

等待安装完成即可。

3jdk环境

本例中直接使用openjdk。

4下载并解压eclipse

解压后添加运行权限

chmod +x eclipse

5安装Tomcat

下载并解压Tomcat6.0.36.tar.gz

运行tomcat文件夹中的startup.sh

http://localhost:8080

看到欢迎界面则一切正常。

配置Tomcat自动启动

sudo vim /etc/init.d/Tomcat6
#!/bin/bash
# chkconfig: 2345 10 90
# description: Auto-starts tomcat6
# /etc/init.d/tomcat6
# Tomcat auto-start
# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network

#set -x

#service network restart

RETVAL=0
#export JRE_HOME=/usr/lib64/jvm/jre
export CATALINA_HOME_6=/home/bupt/programFiles/apache-tomcat-6.0.36
export CATALINA_BASE_6=/home/bupt/programFiles/apache-tomcat-6.0.36
start()
{
	
        if [ -f $CATALINA_HOME_6/bin/startup.sh ];
          then
            echo $"Starting Tomcat6"
                $CATALINA_HOME_6/bin/startup.sh
            RETVAL=$?
            echo " OK"
            return $RETVAL
        fi
}
stop()
{
        if [ -f $CATALINA_HOME_6/bin/shutdown.sh ];
          then
            echo $"Stopping Tomcat"
                $CATALINA_HOME_6/bin/shutdown.sh
            RETVAL=$?
            sleep 1
            ps -fwwu tomcat | grep apache-tomcat|grep -v grep | grep -v PID | awk '{print $2}'|xargs kill -9
            echo " OK"
            # [ $RETVAL -eq 0 ] && rm -f /var/lock/...
            return $RETVAL
        fi
}

case "$1" in
start)
        start
        ;;
stop) 
        stop
        ;;
                                               
restart)
         echo $"Restaring Tomcat6"
         $0 stop
         sleep 1
         $0 start
         ;;
*)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
exit $RETVAL

保存退出。

sudo chmod a+x Tomcat6
sudo chkconfig --add Tomcat6
sudo chkconfig --list Tomcat6

如果出现:

注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。
Tomcat6         0:关    1:关    2:开    3:开    4:开    5:开    6:关

则一切正常。

chkconfig Tomcat6 on

重启之后Tomcat自动启动。

6安装MySQL

yum  install mysql mysql-server

安装成功之后设置自动启动。

systemctl enable mysqld.service
systemctl start mysqld.service

创建密码并登陆mysql

mysqladmin -u root password myownsecrectpass
mysql -u root –p

新建用户

mysql> CREATE USER 'webuser'@'%' IDENTIFIED BY 'password123';

授权

mysql> GRANT ALL ON *.* TO 'webuser'@'%';

更新

mysql> FLUSH PRIVILEGES;

新建用户已经可以从远程登陆,下面开放root用户远程登陆权限。

GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;  
FLUSH PRIVILEGES;

如果不能访问则应该关闭防火墙或添加允许信息。

sudo vim /etc/sysconfig/iptables

添加一行

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

如想完全关闭防火墙和SELinux

sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#        enforcing - SELinux security policy is enforced.
#        permissive - SELinux prints warnings instead of enforcing.
#        disabled - SELinux is fully disabled.
SELINUX = disabled       #修改
# SELINUXTYPE= type of policy in use. Possible values are:
#        targeted - Only targeted network daemons are protected.
#        strict - Full SELinux protection.
SELINUXTYPE=targeted

7安装VNCServer

服务器远程是必需的工具

安装

yum install vnc-server tigervnc-server

启动

vncserver

查看

vncserver –list

关闭

vncserver –kill :1

设置自启动

sudo cp /lib/systemd/system/[email protected] /etc/systemd /system/vncserver@:1.service

添加

User=username

保存后退出并运行

sudo systemctl --system daemon-reload
sudo systemctl enable vncserver@:1.service 
sudo systemctl start vncserver@:1.service
vncpasswd

相关推荐