Difference between revisions of "Ubuntu"
m (Added installing Teamspeak3 server on Ubuntu 16.04 via CLI) |
|||
Line 86: | Line 86: | ||
Test your connection using the <CUSTOM UDP Port> | Test your connection using the <CUSTOM UDP Port> | ||
== Factorio Headless Setup == | |||
Resources: | |||
* [https://wiki.factorio.com/Multiplayer Multiplayer Factorio wiki] | |||
* Stable [https://www.factorio.com/download-headless Factorio headless] server | |||
Check that your version of glibc is >= 2.18. | |||
<pre>robot01@apu01:~$ ldd --version | |||
ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23 | |||
Copyright (C) 2016 Free Software Foundation, Inc. | |||
This is free software; see the source for copying conditions. There is NO | |||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |||
Written by Roland McGrath and Ulrich Drepper.</pre> | |||
Output of ldd command confirms glibc version 2.23. | |||
Switch to <code>/opt</code> directory and download latest Factorio stable headless version (0.16.36 as of this writing) | |||
<pre>robot01@apu01:~$ cd /opt | |||
robot01@apu01:/opt$ sudo wget https://www.factorio.com/get-download/0.16.36/headless/linux64 | |||
... | |||
... | |||
... | |||
Saving to: ‘linux64’ | |||
linux64 100%[==================================>] 23.04M 401KB/s in 2m 48s | |||
2018-05-01 20:38:47 (141 KB/s) - ‘linux64’ saved [24163736/24163736]</pre> | |||
Rename file to match version (0.16.36 in this example) | |||
<pre>robot01@apu01:/opt$ sudo mv linux64 factorio_headless_x64_0.16.36.tar.xz</pre> | |||
Extract archived and zipped file | |||
<pre>robot01@apu01:/opt$ sudo tar -xJf factorio_headless_x64_0.16.36.tar.xz | |||
robot01@apu01:/opt$ ls -l | |||
total 47204 | |||
drwxr-xr-x 4 root root 4096 May 1 21:12 factorio | |||
-rw-r--r-- 1 factorio factorio 24163736 May 1 20:56 factorio_headless_x64_0.16.36.tar.xz</pre> | |||
Remove file (save space, you can always download again if needed) | |||
<pre>robot01@apu01:/opt$ sudo rm factorio_headless_x64_0.16.36.tar.xz</pre> | |||
Add a new user to run factorio and assign ownership of <code>/opt/factorio</code> directory to same user | |||
<pre>robot01@apu01:/opt$ sudo useradd factorio | |||
robot01@apu01:/opt$ sudo chown -R factorio:factorio /opt/factorio/</pre> | |||
Verify permissions show factorio for both user and group | |||
<pre>robot01@apu01:/opt$ ls -l | |||
total 4 | |||
drwxr-xr-x 4 factorio factorio 4096 May 1 21:12 factorio</pre> | |||
Test Factorio binary by switching to factorio user then start server | |||
<pre>robot01@apu01:/opt$ sudo su - factorio | |||
No directory, logging in with HOME=/ | |||
$</pre> | |||
Start server and look for something like "File /savename does not exist." | |||
<pre>$ /opt/factorio/bin/x64/factorio --start-server savename | |||
0.000 2018-05-01 21:20:47; Factorio 0.16.36 (build 36253, linux64, headless) | |||
0.260 Operating system: Linux (Ubuntu 16.04) | |||
0.260 Program arguments: "/opt/factorio/bin/x64/factorio" "--start-server" "savename" | |||
0.260 Read data path: /opt/factorio/data | |||
0.260 Write data path: /opt/factorio [103696/111098MB] | |||
0.260 Binaries path: /opt/factorio/bin | |||
0.304 System info: [CPU: AMD G-T40E Processor, 2 cores, RAM: 3550 MB] | |||
0.304 Environment: DISPLAY=<unset>, WAYLAND_DISPLAY=<unset> | |||
0.305 Running in headless mode | |||
0.316 Error GlobalModSettings.cpp:107: Failed to migrate mod settings file: Error when opening /opt/factorio/mods/mod-settings.json for reading: No such file or directory | |||
0.322 Loading mod core 0.0.0 (data.lua) | |||
0.388 Loading mod base 0.16.36 (data.lua) | |||
1.063 Loading mod base 0.16.36 (data-updates.lua) | |||
1.313 Checksum for core: 1316978547 | |||
1.313 Checksum of base: 4140083139 | |||
2.006 Info PlayerData.cpp:67: Local player-data.json unavailable | |||
2.006 Info PlayerData.cpp:72: Cloud player-data.json unavailable | |||
2.012 Custom inputs active: 0 | |||
2.015 Factorio initialised | |||
2.016 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0). | |||
2.016 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(Ready) to(PreparedToHostGame) | |||
2.016 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame) | |||
2.017 Loading map /savename | |||
2.017 Error ServerMultiplayerManager.cpp:96: MultiplayerManager failed: "File /savename does not exist." | |||
2.017 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(CreatingGame) to(InitializationFailed) | |||
2.017 Info GlobalContext.cpp:694: Waiting for child processes to exit: | |||
2.020 Info ServerMultiplayerManager.cpp:142: Quitting multiplayer connection. | |||
2.020 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(InitializationFailed) to(Closed) | |||
2.062 Info UDPSocket.cpp:206: Closing socket | |||
2.065 Goodbye</pre> | |||
As factorio user create <code>/opt/factorio/</code> saves directory | |||
<pre>$ mkdir /opt/factorio/saves</pre> | |||
At this point you can load up saved games or create some games. Before that I want to install Factorio init script | |||
Exit from factorio user back to sudo account | |||
<pre>$ exit | |||
logout</pre> | |||
Switch to <code>/opt</code> directory | |||
<pre>robot01@apu01:/opt/factorio$ cd /opt</pre> | |||
Clone Factorio init script from github | |||
<pre>robot01@apu01:/opt$ sudo git clone https://github.com/Bisa/factorio-init.git | |||
Cloning into 'factorio-init'... | |||
remote: Counting objects: 484, done. | |||
remote: Total 484 (delta 0), reused 0 (delta 0), pack-reused 484 | |||
Receiving objects: 100% (484/484), 109.47 KiB | 0 bytes/s, done. | |||
Resolving deltas: 100% (276/276), done. | |||
Checking connectivity... done.</pre> | |||
Make Factorio start on operating system boot and restart if failure (configurable - I kept defaults for now) | |||
<pre>robot01@apu01:/opt$ sudo cp /opt/factorio-init/factorio.service.example /etc/systemd/system/factorio.service | |||
robot01@apu01:/opt$ sudo systemctl daemon-reload</pre> | |||
Sysvinit | |||
<pre>robot01@apu01:/opt/factorio$ sudo ln -s /opt/factorio-init/factorio /etc/init.d/factorio | |||
robot01@apu01:/opt/factorio$ sudo chmod +x /opt/factorio-init/factorio</pre> | |||
Show help | |||
<pre>robot01@apu01:/opt/factorio$ service factorio help | |||
Usage: /etc/init.d/factorio COMMAND | |||
Available commands: | |||
start Starts the server | |||
stop Stops the server | |||
restart Restarts the server | |||
status Displays server status | |||
players-online Shows online players | |||
players Shows all players | |||
cmd [command/message] Open interactive commandline or send a single command to the server | |||
chatlog [--tail|-t] Print the current chatlog, optionally tail the log to follow in real time | |||
new-game name [map-gen-settings] [map-settings] Stops the server and creates a new game with the specified name using the specified map gen settings and map settings json files | |||
save-game name Stops the server and saves game to specified save | |||
load-save name Stops the server and loads the specified save | |||
install [tarball] Installs the server with optional specified tarball (omit to download and use the latest headless server from Wube) | |||
update [--dry-run] Updates the server | |||
invocation Outputs the invocation for debugging purpose | |||
listcommands List all init-commands | |||
listsaves List all saves | |||
version Prints the binary version | |||
help Shows this help message</pre> | |||
Setup Autocompletion | |||
<pre>robot01@apu01:/opt/factorio$ sudo ln -s /opt/factorio-init/bash_autocomplete /etc/bash_completion.d/factorio | |||
robot01@apu01:/opt/factorio$ sudo echo "source /opt/factorio-init/bash_autocomplete" >> ~/.bashrc</pre> | |||
Copy example server settings (make any changes you want to copy) | |||
<pre>robot01@apu01:/opt/factorio$ sudo cp /opt/factorio/data/server-settings.example.json /opt/factorio/data/server-settings.json</pre> | |||
Copy example configuration (make any changes you want to copy) | |||
<pre>robot01@apu01:/opt/factorio$ sudo cp /opt/factorio-init/config.example /opt/factorio-init/config</pre> | |||
Make any changes to config ini | |||
<pre>robot01@apu01:/opt/factorio$ sudo vi /opt/factorio/config/config.ini</pre> | |||
== Hardware == | == Hardware == |
Revision as of 20:49, 1 May 2018
Shell commands
Enable root account (not recommended):
$sudo passwd root
Disable root account you lock root account:
$sudo passwd -l root
Want to use root @ console:
$sudo -i
Windows Dual Boot page
Recovering Ubuntu After Windows Install
Grub2 on Ubuntu wiki
Grub2 GUI Customizer
For support-related question you can use Launchpad. You can also search the complete history of questions and answers.
Grub 2 basics
CLI Software Management
Synchronize package index from Internet. Location of repositories /etc/apt/sources.list
sudo apt-get update
Install newest versions of all software packages
sudo apt-get upgrade
Update distribution
sudo apt-get dist-upgrade
Install package (if already installed, will attempt to update package)
apt-get install package-name
List installed packages
apt list --installed
PostgreSQL
Switch to postgres account
sudo -i postgres
Access PostgreSQL prompt
psql
Exit PostgreSQL prompt
\q
Log directly into PostgreSQL prompt with postgres user
sudo -u postgres psql
Add user (username must be same as PostgreSQL role and database)
sudo adduser user_name
Check current connection information
\conninfo
While logged in as postgres user...
Create a new role. Use man createuser
for more information.
createuser --interactive
Create new database
createdb db_name
Same user connect to different database
psql -d postgres
Teamspeak3 setup on Ubuntu 16.04 via command line
Followed steps at How to install Teamspeak 3 server on Ubuntu 16.04 64-bit to install Teamspeak 3 and get basic server running.
If you want to customize the server port follow next steps.
Install simple command-line program named sqlite3
robot00@apu00:~$ sudo apt install sqlite3
Launch sqlite3 using Teamspeak 3 sqlite database file:
robot00@apu00:~$ sudo sqlite3 /home/teamspeak/ts3server.sqlitedb SQLite version 3.11.0 2016-02-15 17:29:24 Enter ".help" for usage hints.
Update port command:
sqlite> update servers set server_port=<CUSTOM UDP Port>;
Restart Teamspeak 3 server
robot00@apu00:~$ systemctl restart teamspeak.service
Test your connection using the <CUSTOM UDP Port>
Factorio Headless Setup
Resources:
- Multiplayer Factorio wiki
- Stable Factorio headless server
Check that your version of glibc is >= 2.18.
robot01@apu01:~$ ldd --version ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper.
Output of ldd command confirms glibc version 2.23.
Switch to /opt
directory and download latest Factorio stable headless version (0.16.36 as of this writing)
robot01@apu01:~$ cd /opt robot01@apu01:/opt$ sudo wget https://www.factorio.com/get-download/0.16.36/headless/linux64 ... ... ... Saving to: ‘linux64’ linux64 100%[==================================>] 23.04M 401KB/s in 2m 48s 2018-05-01 20:38:47 (141 KB/s) - ‘linux64’ saved [24163736/24163736]
Rename file to match version (0.16.36 in this example)
robot01@apu01:/opt$ sudo mv linux64 factorio_headless_x64_0.16.36.tar.xz
Extract archived and zipped file
robot01@apu01:/opt$ sudo tar -xJf factorio_headless_x64_0.16.36.tar.xz robot01@apu01:/opt$ ls -l total 47204 drwxr-xr-x 4 root root 4096 May 1 21:12 factorio -rw-r--r-- 1 factorio factorio 24163736 May 1 20:56 factorio_headless_x64_0.16.36.tar.xz
Remove file (save space, you can always download again if needed)
robot01@apu01:/opt$ sudo rm factorio_headless_x64_0.16.36.tar.xz
Add a new user to run factorio and assign ownership of /opt/factorio
directory to same user
robot01@apu01:/opt$ sudo useradd factorio robot01@apu01:/opt$ sudo chown -R factorio:factorio /opt/factorio/
Verify permissions show factorio for both user and group
robot01@apu01:/opt$ ls -l total 4 drwxr-xr-x 4 factorio factorio 4096 May 1 21:12 factorio
Test Factorio binary by switching to factorio user then start server
robot01@apu01:/opt$ sudo su - factorio No directory, logging in with HOME=/ $
Start server and look for something like "File /savename does not exist."
$ /opt/factorio/bin/x64/factorio --start-server savename 0.000 2018-05-01 21:20:47; Factorio 0.16.36 (build 36253, linux64, headless) 0.260 Operating system: Linux (Ubuntu 16.04) 0.260 Program arguments: "/opt/factorio/bin/x64/factorio" "--start-server" "savename" 0.260 Read data path: /opt/factorio/data 0.260 Write data path: /opt/factorio [103696/111098MB] 0.260 Binaries path: /opt/factorio/bin 0.304 System info: [CPU: AMD G-T40E Processor, 2 cores, RAM: 3550 MB] 0.304 Environment: DISPLAY=<unset>, WAYLAND_DISPLAY=<unset> 0.305 Running in headless mode 0.316 Error GlobalModSettings.cpp:107: Failed to migrate mod settings file: Error when opening /opt/factorio/mods/mod-settings.json for reading: No such file or directory 0.322 Loading mod core 0.0.0 (data.lua) 0.388 Loading mod base 0.16.36 (data.lua) 1.063 Loading mod base 0.16.36 (data-updates.lua) 1.313 Checksum for core: 1316978547 1.313 Checksum of base: 4140083139 2.006 Info PlayerData.cpp:67: Local player-data.json unavailable 2.006 Info PlayerData.cpp:72: Cloud player-data.json unavailable 2.012 Custom inputs active: 0 2.015 Factorio initialised 2.016 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0). 2.016 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(Ready) to(PreparedToHostGame) 2.016 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame) 2.017 Loading map /savename 2.017 Error ServerMultiplayerManager.cpp:96: MultiplayerManager failed: "File /savename does not exist." 2.017 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(CreatingGame) to(InitializationFailed) 2.017 Info GlobalContext.cpp:694: Waiting for child processes to exit: 2.020 Info ServerMultiplayerManager.cpp:142: Quitting multiplayer connection. 2.020 Info ServerMultiplayerManager.cpp:698: mapTick(4294967295) changing state from(InitializationFailed) to(Closed) 2.062 Info UDPSocket.cpp:206: Closing socket 2.065 Goodbye
As factorio user create /opt/factorio/
saves directory
$ mkdir /opt/factorio/saves
At this point you can load up saved games or create some games. Before that I want to install Factorio init script
Exit from factorio user back to sudo account
$ exit logout
Switch to /opt
directory
robot01@apu01:/opt/factorio$ cd /opt
Clone Factorio init script from github
robot01@apu01:/opt$ sudo git clone https://github.com/Bisa/factorio-init.git Cloning into 'factorio-init'... remote: Counting objects: 484, done. remote: Total 484 (delta 0), reused 0 (delta 0), pack-reused 484 Receiving objects: 100% (484/484), 109.47 KiB | 0 bytes/s, done. Resolving deltas: 100% (276/276), done. Checking connectivity... done.
Make Factorio start on operating system boot and restart if failure (configurable - I kept defaults for now)
robot01@apu01:/opt$ sudo cp /opt/factorio-init/factorio.service.example /etc/systemd/system/factorio.service robot01@apu01:/opt$ sudo systemctl daemon-reload
Sysvinit
robot01@apu01:/opt/factorio$ sudo ln -s /opt/factorio-init/factorio /etc/init.d/factorio robot01@apu01:/opt/factorio$ sudo chmod +x /opt/factorio-init/factorio
Show help
robot01@apu01:/opt/factorio$ service factorio help Usage: /etc/init.d/factorio COMMAND Available commands: start Starts the server stop Stops the server restart Restarts the server status Displays server status players-online Shows online players players Shows all players cmd [command/message] Open interactive commandline or send a single command to the server chatlog [--tail|-t] Print the current chatlog, optionally tail the log to follow in real time new-game name [map-gen-settings] [map-settings] Stops the server and creates a new game with the specified name using the specified map gen settings and map settings json files save-game name Stops the server and saves game to specified save load-save name Stops the server and loads the specified save install [tarball] Installs the server with optional specified tarball (omit to download and use the latest headless server from Wube) update [--dry-run] Updates the server invocation Outputs the invocation for debugging purpose listcommands List all init-commands listsaves List all saves version Prints the binary version help Shows this help message
Setup Autocompletion
robot01@apu01:/opt/factorio$ sudo ln -s /opt/factorio-init/bash_autocomplete /etc/bash_completion.d/factorio robot01@apu01:/opt/factorio$ sudo echo "source /opt/factorio-init/bash_autocomplete" >> ~/.bashrc
Copy example server settings (make any changes you want to copy)
robot01@apu01:/opt/factorio$ sudo cp /opt/factorio/data/server-settings.example.json /opt/factorio/data/server-settings.json
Copy example configuration (make any changes you want to copy)
robot01@apu01:/opt/factorio$ sudo cp /opt/factorio-init/config.example /opt/factorio-init/config
Make any changes to config ini
robot01@apu01:/opt/factorio$ sudo vi /opt/factorio/config/config.ini
Hardware
Identify video card:
paul@congo:~$ lspci -nn | grep VGA 01:00.0 VGA compatible controller [0300]: nVidia Corporation G92 [GeForce 8800 GT] [10de:0611] (rev a2)