or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Linux基本操作
架設麥塊Server
我是黃爾群
一個在很忙的時候還要抽出時間來準備講義的大三生QQ
也是IND的教學~
OS
shell
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →ssh
secure shell
其實就是一種遠端連線
不過是文字介面的
相比以前的telnet、rsh更安全
用法
ssh -p {port} {user}@{host}
ex.
ssh -p 2222 myuser@140.121.140.121
接下來請各位使用ssh到我們今天的練習機
可用軟體:
Commands
passwd
修改密碼
也可以修改別人的(請不要這麼做,尊重其他使用者,除非你知道自己在做什麼)
ls
列出目錄中的檔案與目錄列表
常用參數
-l -h -a
ex.
ls -alh
cd
進入資料夾
ex.
cd Documents
pwd
顯示目前的目錄位置
echo
輸出文字
ex.
echo "Hello World!!!"
輸入檔案用法:
ex.
echo "Hello World!!!" > hello
cat
叫貓貓去看一下檔案檢視檔案內容
ex.
cat hello
head
檢視檔案前10行
常用參數
-n
ex.
head -n 4 .bashrc
tail
檢視檔案最後10行
常用參數
-n
ex.
tail -n 14 .bashrc
vim
文字界面編輯器
不一定會有安裝
分成三種模式
一開始是normal mode 按i進入edit mode
按ESC回到normal mode
在normal mode打冒號可以輸入指令
:w
:wq
:q!
vim是個很強大的編輯器
在normal mode可以用的指令還有連技超多
如果想了解的可以看看 這個
推薦要學 只能用文字介面的時候非常好用
cp
複製
ex.
cp hello hello-copy
mv
移動、更名
ex.
mv hello ../hello
mkdir
創建資料夾
ex.
mkdir my-dir
不一定有安裝
wget
下載檔案
ex.
wget www.google.com
curl
也是一種下載檔案 支援更多東西
ex.
curl www.google.com
ifconfig
檢視網路卡資訊
ex.
ifconfig -a
arp
檢視arp table
ex.
arp -a
zip、unzip
壓縮、解壓縮
ex.
zip my.zip hello world
ex.
unzip my.zip
ex.
unzip -l my.zip
(只看不解壓縮)Linux 資料夾結構
~
/
./
../
permission denied?
sudo
means 'superuser do'
ex.
sudo cat /.dockerenv
ex.
sudo chmod 777 hello
ex.
sudo chmod +x hello
安裝套件
apt
sudo apt install vim
終於可以架設伺服器ㄌ…
Download Server File
有幾種方式可以把檔案弄到虛擬機裡
有可能出現錯誤
-bash: java: command not found
這個代表什麼?
-> 沒有這個指令
就是沒有安裝java啦~
sudo apt install openjdk-8-jdk
裝好後可以
java -version
看看有沒有東西再來就可以依照官網的說明試看看了
第一次啟動的時候 會發現它一下子就結束了
讀了一下剛剛的輸出會發現他叫你去同意一個東西(EULA)
代表要同意EULA後才能繼續
請看一下現在資料夾裡面多的檔案並編輯EULA裡面的false為true
再次啟動之後就會真正地開好server了~
嗎?
有一部分人會用同一個機器,所以有的port就會被佔用了
這時候再看看你的資料夾 會有一個server.properties
裡面是一些伺服器的設定
把
server.port
改掉再重新啟動就可以了port範圍 -> 1 - 65535 (請使用10000以上的port)
server.properties各設定作用
今日作業:
請各位在自己的機器上裝"虛擬機"
並成功開好一個minecraft伺服器
要注意NAT (port forwarding)設定