@TOC

!!!!参考文章
sudo nano /etc/dhcpcd.conf
# 指定接口 eth0
interface eth0
# 指定静态IP,/24表示子网掩码为 255.255.255.0
static ip_address=192.168.1.20/24
# 路由器/网关IP地址
static routers=192.168.1.1
# 手动自定义DNS服务器
static domain_name_servers=114.114.114.114
#保存
ctrl+o
#退出
ctrl+x
#重启
sudo reboot
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="wi-fi name here"
psk="wi-fi password here"
key_mgmt=WPA-PSK
}
network={
ssid="another wi-fi name here"
psk="another wi-fi password here"
key_mgmt=WPA-PSK
}
在TF卡的boot目录下找到config.txt,打开,修改配置选项。
#hdmi_force_hotplug=1这句话,把前面的#注释符号去掉,启用HDMI热插拔功能。
#config_hdmi_boost=4这句话,把前面的#注释符号去掉,启用加强HDMI信号

!!!!!!!参考链接
sudo raspi-config。sudo apt-get install ufw #安装
sudo ufw enable #启用
sudo ufw default deny
sudo ufw disable #关闭
sudo ufw status #查看状态
sudo ufw allow 22 #允许外部访问ssh登录
sudo ufw allow 80 #允许外部访问80端口
sudo ufw delete allow 80 #禁止外部访问80 端口
sudo tar zxf + 你的jdk压缩包sudo nano /ect/profile# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
JAVA_HOME=/home/pi/jdk的文件名
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME
export PATH
export CLASSPATH
重启树莓派sudo rebootjava -version
1.sudo chmod -R 777 /工作目录
2.
sudo passwd
他会提示你输入新密码,再次输入密码,就输入以前的一样的就行,成功之后,输入
su root
再次输入密码即可~
这时候你会发现你输入命令前的 $ 号已经变成 # 号,这就证明你已经成功了
./startup.sh 打开
./shutdown.sh 关闭
在树莓派的浏览器访问端口为8080的网页。localhost:8080
同一个局域网下可以连接
-
真香~
/home/pi/apache-tomcat-7.0.103/webapps/ROOT在这个路径下放HTML文件,可以直接运行
随便下的一个网站。
总的来说还不错。就差一个内外网穿透了。内外网穿透应该就可以做小型的个人的服务器了。
以下代码的参考来源参考链接
sudo apt-get install mariadb-server sudo mysql 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.1.38-MariaDB-0+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
use mysql;
UPDATE user SET password=password('password') WHERE user='root';
UPDATE user SET plugin='mysql_native_password' WHERE user = 'root';
flush privileges;
exit
sudo systemctl restart mariadb mysql -u root -p
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
文件内容
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
bind-address表示只监听了127.0.0.1这个IP,将这一行的前面加上# 将这一行注释起来,这样MariaDB就监听了所有的IP。
此时从外部的电脑连接MariaDB会提示"xxx.xxx.xxx is not allowed to connect to this MariaDB Server"。同样使用上一步中的mysql命令连接到MariaDB,输入如下命令:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
--格式如下
GRANT ALL PRIVILEGES ON *.* TO 'user'@'remoteip' IDENTIFIED BY 'password' WITH GRANT OPTION;
--更新权限
FLUSH PRIVILEGES;
至此可从外部连接到树莓派上的MariaDB了


!!!东西都从这里搬过来的,有需要直接访问原地址!!!


./frps -c ./frps.ini 
好了结束了我的树莓派





















