Jump to content

brent

Administrators
  • Content Count

    54
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by brent

  1. Installing CIFS Utilities Packages To mount a Windows share on a Linux system, first you need to install the CIFS utilities package. Installing CIFS utilities on CentOS and Fedora: sudo dnf install cifs-utils Auto Mounting sudo nano /etc/fstab Add the following line to the file: # <file system> <dir> <type> <options> <dump> <pass> //WIN_SHARE_IP/share_name /mnt/win_share cifs credentials=/etc/win-credentials,file_mode=0755,dir_mode=0755 0 0 Run the following command to mount the share: Run the following command to mount the share: Creating Credential File For better security it is recommended to use a credentials file, which contains the share username, password and domain. /etc/win-credentials The credentials file has the following format: username = user password = password domain = domain The file must not be readable by users. To set the correct permissions and ownership run: sudo chown root: /etc/win-credentials sudo chmod 600 /etc/win-credentials
  2. How to Import and Export Databases Export To Export a database, open up terminal, making sure that you are not logged into MySQL and type, mysqldump -u [username] -p [database name] > [database name].sql The database that you selected in the command will now be exported to your droplet. Import To import a database, first create a new blank database in the MySQL shell to serve as a destination for your data. CREATE DATABASE newdatabase; Then log out of the MySQL shell and type the following on the command line: mysql -u [username] -p newdatabase < [database name].sql With that, your chosen database has been imported into your destination database in MySQL.
  3. Security Enhanced Linux or SELinux is a security mechanism built into the Linux kernel used by RHEL-based distributions. SELinux adds an additional layer of security to the system by allowing administrators and users to control access to objects based on policy rules. SELinux policy rules specify how processes and users interact with each other as well as how processes and users interact with files. When there is no rule explicitly allowing access to an object, such as for a process opening a file, access is denied. SELinux has three modes of operation: Enforcing: SELinux allows access based on SELinux policy rules. Permissive: SELinux only logs actions that would have been denied if running in enforcing mode. This mode is useful for debugging and creating new policy rules. Disabled: No SELinux policy is loaded, and no messages are logged. By default, in CentOS 8, SELinux is enabled and in enforcing mode. It is highly recommended to keep SELinux in enforcing mode. However, sometimes it may interfere with the functioning of some application, and you need to set it to the permissive mode or disable it completely. In this tutorial, we will explain to disable SELinux on CentOS 8. Prerequisites Only the root user or a user with sudo privileges can change the SELinux mode. Checking the SELinux Mode Use the sestatus command to check the status and the mode in which SELinux is running: sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31 The output above shows that SELinux is enabled and set to enforcing mode. Changing SELinux Mode to Permissive When enabled, SELinux can be either in enforcing or permissive mode. You can temporarily change the mode from targeted to permissive with the following command: sudo setenforce 0 However, this change is valid for the current runtime session only and do not persist between reboots. To permanently set the SELinux mode to permissive, follow the steps below: Open the /etc/selinux/config file and set the SELINUX mod to permissive: /etc/selinux/config # 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 - No SELinux policy is loaded. SELINUX=permissive # SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted Copy Save the file and run the setenforce 0 command to change the SELinux mode for the current session: sudo shutdown -r now Disabling SELinux Instead of disabling SELinux, it is strongly recommended to change the mode to permissive. Disable SELinux only when required for the proper functioning of your application. Perform the steps below to disable SELinux on your CentOS 8 system permanently: Open the /etc/selinux/config file and change the SELINUX value to disabled: /etc/selinux/config # 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 - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted Copy Save the file and reboot the system: sudo shutdown -r now When the system is booted, use the sestatus command to verify that SELinux has been disabled: sestatus The output should look like this: SELinux status: disabled Conclusion SELinux is a mechanism to secure a system by implementing mandatory access control (MAC). SELinux is enabled by default on CentOS 8 systems, but it can be disabled by editing the configuration file and rebooting the system. To learn more about the powerful features of SELinux, visit the CentOS SELinux guide.
  4. Introduction The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software. In this guide, you will install an Apache web server with virtual hosts on your CentOS 8 server. Prerequisites You will need the following to complete this guide: A non-root user with sudo privileges configured on your server, set up by following the initial server setup guide for CentOS 8. Ensure that a basic firewall is configured by following Step 4 of the Initial Server Setup with CentOS 8 (recommended) in the above guide. Step 1 — Installing Apache Apache is available within CentOS’s default software repositories, which means you can install it with the dnf package manager. As the non-root sudo user configured in the prerequisites, install the Apache package: sudo dnf install httpd After confirming the installation, dnf will install Apache and all required dependencies. By completing Step 4 of the Initial Server Setup with CentOS 8 guide mentioned in the prerequisites section, you will have already installed firewalld on your server to serve requests over HTTP. If you also plan to configure Apache to serve content over HTTPS, you will also want to open up port 443 by enabling the https service: sudo firewall-cmd --permanent --add-service=https Next, reload the firewall to put these new rules into effect: sudo firewall-cmd --reload After the firewall reloads, you are ready to start the service and check the web server. Step 2 — Checking your Web Server Apache does not automatically start on CentOS once the installation completes, so you will need to start the Apache process manually: sudo systemctl start httpd Verify that the service is running with the following command: sudo systemctl status httpd You will receive an active status when the service is running: Output ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disa> Active: active (running) since Thu 2020-04-23 22:25:33 UTC; 11s ago Docs: man:httpd.service(8) Main PID: 14219 (httpd) Status: "Running, listening on: port 80" Tasks: 213 (limit: 5059) Memory: 24.9M CGroup: /system.slice/httpd.service ├─14219 /usr/sbin/httpd -DFOREGROUND ├─14220 /usr/sbin/httpd -DFOREGROUND ├─14221 /usr/sbin/httpd -DFOREGROUND ├─14222 /usr/sbin/httpd -DFOREGROUND └─14223 /usr/sbin/httpd -DFOREGROUND ... As this output indicates, the service has started successfully. However, the best way to test this is to request a page from Apache. You can access the default Apache landing page to confirm that the software is running properly through your IP address. If you do not know your server’s IP address, you can get it a few different ways from the command line. Type q to return to the command prompt and then type: hostname -I This command will display all of the host’s network addresses, so you will get back a few IP addresses separated by spaces. You can try each in your web browser to determine whether they work. Alternatively, you can use curl to request your IP from icanhazip.com, which will give you your public IPv4 address as read from another location on the internet: curl -4 icanhazip.com When you have your server’s IP address, enter it into your browser’s address bar: http://your_server_ip You’ll see the default CentOS 8 Apache web page: This page indicates that Apache is working correctly. It also includes some basic information about important Apache files and directory locations. Step 3 — Managing the Apache Process Now that the service is installed and running, you can now use different systemctl commands to manage the service. To stop your web server, type: sudo systemctl stop httpd To start the web server when it is stopped, type: sudo systemctl start httpd To stop and then start the service again, type: sudo systemctl restart httpd If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, use this command: sudo systemctl reload httpd By default, Apache is configured to start automatically when the server boots. If this is not what you want, disable this behavior by typing: sudo systemctl disable httpd To re-enable the service to start up at boot, type: sudo systemctl enable httpd Apache will now start automatically when the server boots again. The default configuration for Apache will allow your server to host a single website. If you plan on hosting multiple domains on your server, you will need to configure virtual hosts on your Apache web server. Step 4 — Setting Up Virtual Hosts (Recommended) When using the Apache web server, you can use virtual hosts (if you are more familiar with Nginx, these are similar to server blocks) to encapsulate configuration details and host more than one domain from a single server. In this step, you will set up a domain called example.com, but you should replace this with your own domain name. If you are setting up a domain name with DigitalOcean, please refer to our Networking Documentation. Apache on CentOS 8 has one virtual host enabled by default that is configured to serve documents from the /var/www/html directory. While this works well for a single site, it can become unwieldy if you are hosting multiple sites. Instead of modifying /var/www/html, you will create a directory structure within /var/www for the example.com site, leaving /var/www/html in place as the default directory to be served if a client request doesn’t match any other sites. Create the html directory for example.com as follows, using the -p flag to create any necessary parent directories: sudo mkdir -p /var/www/example.com/html Create an additional directory to store log files for the site: sudo mkdir -p /var/www/example.com/log Next, assign ownership of the html directory with the $USER environmental variable: sudo chown -R $USER:$USER /var/www/example.com/html Make sure that your web root has the default permissions set: sudo chmod -R 755 /var/www Next, create a sample index.html page using vi or your favorite editor: sudo vi /var/www/example.com/html/index.html Press i to switch to INSERT mode and add the following sample HTML to the file: /var/www/example.com/html/index.html <html> <head> <title>Welcome to Example.com!</title> </head> <body> <h1>Success! The example.com virtual host is working!</h1> </body> </html> Copy Save and close the file by pressing ESC, typing :wq, and pressing ENTER. With your site directory and sample index file in place, you are almost ready to create the virtual host files. Virtual host files specify the configuration of your separate sites and tell the Apache web server how to respond to various domain requests. Before you create your virtual hosts, you will need to create a sites-available directory to store them in. You will also create the sites-enabled directory that tells Apache that a virtual host is ready to serve to visitors. The sites-enabled directory will hold symbolic links to virtual hosts that we want to publish. Create both directories with the following command: sudo mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled Next, you will tell Apache to look for virtual hosts in the sites-enabled directory. To accomplish this, edit Apache’s main configuration file using vi or your favorite text editor and add a line declaring an optional directory for additional configuration files: sudo vi /etc/httpd/conf/httpd.conf Press capital G to navigate towards the end of the file. Then press i to switch to INSERT mode and add the following line to the very end of the file: /etc/httpd/conf/httpd.conf ... # Supplemental configuration # # Load config files in the "/etc/httpd/conf.d" directory, if any. IncludeOptional conf.d/*.conf IncludeOptional sites-enabled/*.conf Save and close the file when you are done adding that line. Now that you have your virtual host directories in place, you will create your virtual host file. Start by creating a new file in the sites-available directory: sudo vi /etc/httpd/sites-available/example.com.conf Add in the following configuration block, and change the example.com domain to your domain name: /etc/httpd/sites-available/example.com.conf <VirtualHost *:80> ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/example.com/html ErrorLog /var/www/example.com/log/error.log CustomLog /var/www/example.com/log/requests.log combined </VirtualHost> Copy This will tell Apache where to find the root directly that holds the publicly accessible web documents. It also tells Apache where to store error and request logs for this particular site. Save and close the file when you are finished. Now that you have created the virtual host files, you will enable them so that Apache knows to serve them to visitors. To do this, create a symbolic link for each virtual host in the sites-enabled directory: sudo ln -s /etc/httpd/sites-available/example.com.conf /etc/httpd/sites-enabled/example.com.conf Your virtual host is now configured and ready to serve content. Before restarting the Apache service, let’s make sure that SELinux has the correct policies in place for your virtual hosts. Step 5 — Adjusting SELinux Permissions for Virtual Hosts (Recommended) SELinux is a Linux kernel security module that brings heightened security for Linux systems. CentOS 8 comes equipped with SELinux configured to work with the default Apache configuration. Since you changed the default configuration by setting up a custom log directory in the virtual hosts configuration file, you will receive an error if you attempt to start the Apache service. To resolve this, you need to update the SELinux policies to allow Apache to write to the necessary files. There are different ways to set policies based on your environment’s needs as SELinux allows you to customize your security level. This step will cover two methods of adjusting Apache policies: universally and on a specific directory. Adjusting policies on directories is more secure, and is therefore the recommended approach. Adjusting Apache Policies Universally Setting the Apache policy universally will tell SELinux to treat all Apache processes identically by using the httpd_unified Boolean. While this approach is more convenient, it will not give you the same level of control as an approach that focuses on a file or directory policy. Run the following command to set a universal Apache policy: sudo setsebool -P httpd_unified 1 The setsebool command changes SELinux Boolean values. The -P flag will update the boot-time value, making this change persist across reboots. httpd_unified is the Boolean that will tell SELinux to treat all Apache processes as the same type, so you enabled it with a value of 1. Adjusting Apache Policies on a Directory Individually setting SELinux permissions for the /var/www/example.com/log directory will give you more control over your Apache policies, but may also require more maintenance. Since this option is not universally setting policies, you will need to manually set the context type for any new log directories specified in your virtual host configurations. First, check the context type that SELinux gave the /var/www/example.com/log directory: sudo ls -dlZ /var/www/example.com/log/ This command lists and prints the SELinux context of the directory. You will receive output similar to the following: Output drwxr-xr-x. 2 root root unconfined_u:object_r:httpd_sys_content_t:s0 6 Apr 23 23:51 /var/www/example.com/log/ The current context is httpd_sys_content_t, which tells SELinux that the Apache process can only read files created in this directory. In this tutorial, you will change the context type of the /var/www/example.com/log directory to httpd_log_t. This type will allow Apache to generate and append to web application log files: sudo semanage fcontext -a -t httpd_log_t "/var/www/example.com/log(/.*)?" Next, use the restorecon command to apply these changes and have them persist across reboots: sudo restorecon -R -v /var/www/example.com/log The -R flag runs this command recursively, meaning it will update any existing files to use the new context. The -v flag will print the context changes the command made. You will receive the following output confirming the changes: Output Relabeled /var/www/example.com/log from unconfined_u:object_r:httpd_sys_content_t:s0 to unconfined_u:object_r:httpd_log_t:s0 You can list the contexts once more to see the changes: sudo ls -dlZ /var/www/example.com/log/ The output reflects the updated context type: Output drwxr-xr-x. 2 root root unconfined_u:object_r:httpd_log_t:s0 6 Apr 23 23:51 /var/www/example.com/log/ Now that the /var/www/example.com/log directory is using the httpd_log_t type, you are ready to test your virtual host configuration. Step 6 — Testing the Virtual Host (Recommended) Once the SELinux context has been updated with either method, Apache will be able to write to the /var/www/example.com/log directory. You can now successfully restart the Apache service: sudo systemctl restart httpd List the contents of the /var/www/example.com/log directory to see if Apache created the log files: ls -lZ /var/www/example.com/log You’ll receive confirmation that Apache was able to create the error.log and requests.log files specified in the virtual host configuration: Output -rw-r--r--. 1 root root system_u:object_r:httpd_log_t:s0 0 Apr 24 00:06 error.log -rw-r--r--. 1 root root system_u:object_r:httpd_log_t:s0 0 Apr 24 00:06 requests.log Now that you have your virtual host set up and SELinux permissions updated, Apache will now serve your domain name. You can test this by navigating to http://example.com, where you should see something like this: This confirms that your virtual host is successfully configured and serving content. Repeat Steps 4 and 5 to create new virtual hosts with SELinux permissions for additional domains.
  5. sudo mount -t cifs -o username=serverUserName //myServerIpAdress/sharename /mnt/myFolder/
  6. Configure static IP address using Netplan Netplan network configuration had been first introduced to Ubuntu 18.04 LTS Bionic Beaver. It is available to all new Ubuntu 18.04 installations. Ubuntu Server To configure a static IP address on your Ubuntu 20.04 server you need to modify a relevant netplan network configuration file within /etc/netplan/ directory. network: ethernets: enp0s3: addresses: [192.168.1.3/24] gateway4: 192.168.1.1 nameservers: addresses: [4.2.2.2, 8.8.8.8] version: 2 Once ready apply changes with: $ sudo netplan apply In case you run into some issues execute: $ sudo netplan --debug apply
  7. Tautulli will be installed to /opt/Tautulli. Open a terminal Install Git Ubuntu/Debian: sudo apt-get install git-core Fedora: sudo yum install git Install prerequisites: Ubuntu/Debian: sudo apt-get install python python-setuptools tzdata Fedora: sudo yum install python python2-setuptools Type: cd /opt Type: sudo git clone https://github.com/Tautulli/Tautulli.git Optional: Ubuntu/Debian: sudo addgroup tautulli && sudo adduser --system --no-create-home tautulli --ingroup tautulli CentOS/Fedora: sudo adduser --system --no-create-home tautulli sudo chown tautulli:tautulli -R /opt/Tautulli Type: cd Tautulli Type: python Tautulli.py to start Tautulli Tautulli will be loaded in your browser or listening on http://localhost:8181 To run Tautulli in the background on startup: # Tautulli - Stats for Plex Media Server usage # # Service Unit file for systemd system manager # # INSTALLATION NOTES # # 1. Copy this file into your systemd service unit directory (often '/lib/systemd/system') # and name it 'tautulli.service' with the following command: # sudo cp /opt/Tautulli/init-scripts/init.systemd /lib/systemd/system/tautulli.service # # 2. Edit the new tautulli.service file with configuration settings as required. # More details in the "CONFIGURATION NOTES" section shown below. # # 3. Enable boot-time autostart with the following commands: # sudo systemctl daemon-reload # sudo systemctl enable tautulli.service # # 4. Start now with the following command: # sudo systemctl start tautulli.service # # CONFIGURATION NOTES # # - The example settings in this file assume that you will run Tautulli as user: tautulli # - The example settings in this file assume that Tautulli is installed to: /opt/Tautulli # # - To create this user and give it ownership of the Tautulli directory: # Ubuntu/Debian: sudo addgroup tautulli && sudo adduser --system --no-create-home tautulli --ingroup tautulli # CentOS/Fedora: sudo adduser --system --no-create-home tautulli # sudo chown tautulli:tautulli -R /opt/Tautulli # # - Adjust ExecStart= to point to: # 1. Your Tautulli executable # - Default: /opt/Tautulli/Tautulli.py # 2. Your config file (recommended is to put it somewhere in /etc) # - Default: --config /opt/Tautulli/config.ini # 3. Your datadir (recommended is to NOT put it in your Tautulli exec dir) # - Default: --datadir /opt/Tautulli # # - Adjust User= and Group= to the user/group you want Tautulli to run as. # # - WantedBy= specifies which target (i.e. runlevel) to start Tautulli for. # multi-user.target equates to runlevel 3 (multi-user text mode) # graphical.target equates to runlevel 5 (multi-user X11 graphical mode) [Unit] Description=Tautulli - Stats for Plex Media Server usage Wants=network-online.target After=network-online.target [Service] ExecStart=/opt/Tautulli/Tautulli.py --config /opt/Tautulli/config.ini --datadir /opt/Tautulli --quiet --daemon --nolaunch GuessMainPID=no Type=forking User=tautulli Group=tautulli [Install] WantedBy=multi-user.target
  8. Hot to install Glances sudo apt-get install python-pip build-essential python-dev lm-sensors sudo pip install psutil logutils bottle batinfo https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.tar.gz zeroconf netifaces pymdstat influxdb elasticsearch potsdb statsd pystache docker-py pysnmp pika py-cpuinfo bernhard sudo pip install glances Basic usage To start glances simply type glances in terminal. In glances you’ll see a lot of information about the resources of your system: CPU, Load, Memory, Swap Network, Disk I/O and Processes all in one page, by default the color code means: GREEN : the statistic is “OK” BLUE : the statistic is “CAREFUL” (to watch) VIOLET : the statistic is “WARNING” (alert) RED : the statistic is “CRITICAL” (critical) When Glances is running, you can press some special keys to give commands to it: c: Sort processes by CPU% m: Sort processes by MEM% p: Sort processes by name i: Sort processes by IO Rate d: Show/hide disk I/O stats f: Show/hide file system stats n: Show/hide network stats s: Show/hide sensors stats b: Bit/s or Byte/s for network IO w: Delete warning logs x: Delete warning and critical logs 1: Global CPU or Per Core stats h: Show/hide this help message q: Quit (Esc and Ctrl-C also work) l: Show/hide log messages Cpu , Ram , Swap Monitoring
  9. Step 1 — Installing OpenVPN To start, we will install OpenVPN on the server. We'll also install Easy RSA, a public key infrastructure management tool which will help us set up an internal certificate authority (CA) for use with our VPN. We'll also use Easy RSA to generate our SSL key pairs later on to secure the VPN connections. Log in to the server as the non-root sudo user, and update the package lists to make sure you have all the latest versions. sudo yum update -y The Extra Packages for Enterprise Linux (EPEL) repository is an additional repository managed by the Fedora Project containing non-standard but popular packages. OpenVPN isn't available in the default CentOS repositories but it is available in EPEL, so install EPEL: sudo yum install epel-release -y Then update your package lists once more: sudo yum update -y Next, install OpenVPN and wget, which we will use to install Easy RSA: sudo yum install -y openvpn wget Using wget, download Easy RSA. For the purposes of this tutorial, we recommend using easy-rsa-2 because there’s more available documentation for this version. You can find the download link for the latest version of easy-rsa-2 on the project’s Releases page: wget -O /tmp/easyrsa https://github.com/OpenVPN/easy-rsa-old/archive/2.3.3.tar.gz Next, extract the compressed file with tar: tar xfz /tmp/easyrsa This will create a new directory on your server called easy-rsa-old-2.3.3. Make a new subdirectory under /etc/openvpn and name it easy-rsa: sudo mkdir /etc/openvpn/easy-rsa Copy the extracted Easy RSA files over to the new directory: sudo cp -rf easy-rsa-old-2.3.3/easy-rsa/2.0/* /etc/openvpn/easy-rsa Then change the directory’s owner to your non-root sudo user: sudo chown sammy /etc/openvpn/easy-rsa/ Once these programs are installed and have been moved to the right locations on your system, the next step is to customize the server-side configuration of OpenVPN. Step 2 — Configuring OpenVPN Like many other widely-used open-source tools, there are dozens of configuration options available to you. In this section, we will provide instructions on how to set up a basic OpenVPN server configuration. OpenVPN has several example configuration files in its documentation directory. First, copy the sample server.conf file as a starting point for your own configuration file. sudo cp /usr/share/doc/openvpn-2.4.4/sample/sample-config-files/server.conf /etc/openvpn Open the new file for editing with the text editor of your choice. We’ll use nano in our example, which you can download with the yum install nano command if you don’t have it on your server already: sudo nano /etc/openvpn/server.conf There are a few lines we need to change in this file, most of which just need to be uncommented by removing the semicolon, ;, at the beginning of the line. The functions of these lines, and the other lines not mentioned in this tutorial, are explained in-depth in the comments above each one. To get started, find and uncomment the line containing push "redirect-gateway def1 bypass-dhcp". Doing this will tell your client to redirect all of its traffic through your OpenVPN server. Be aware that enabling this functionality can cause connectivity issues with other network services, like SSH: /etc/openvpn/server.conf push "redirect-gateway def1 bypass-dhcp" Because your client will not be able to use the default DNS servers provided by your ISP (as its traffic will be rerouted), you need to tell it which DNS servers it can use to connect to OpenVPN. You can pick different DNS servers, but here we'll use Google's public DNS servers which have the IPs of 8.8.8.8 and 8.8.4.4. Set this by uncommenting both push "dhcp-option DNS ..." lines and updating the IP addresses: /etc/openvpn/server.conf push "dhcp-option DNS 8.8.8.8" push "dhcp-option DNS 8.8.4.4" We want OpenVPN to run with no privileges once it has started, so we need to tell it to run with a user and group of nobody. To enable this, uncomment the user nobody and group nobody lines: /etc/openvpn/server.conf user nobody group nobody Next, uncomment the topology subnet line. This, along with the server 10.8.0.0 255.255.255.0 line below it, configures your OpenVPN installation to function as a subnetwork and tells the client machine which IP address it should use. In this case, the server will become 10.8.0.1 and the first client will become 10.8.0.2: /etc/openvpn/server.conf topology subnet It’s also recommended that you add the following line to your server configuration file. This double checks that any incoming client certificates are truly coming from a client, hardening the security parameters we will establish in later steps: /etc/openvpn/server.conf remote-cert-eku "TLS Web Client Authentication" Lastly, OpenVPN strongly recommends that users enable TLS Authentication, a cryptographic protocol that ensures secure communications over a computer network. To do this, you will need to generate a static encryption key (named in our example as myvpn.tlsauth, although you can choose any name you like). Before creating this key, comment the line in the configuration file containing tls-auth ta.key 0 by prepending it with a semicolon. Then, add tls-crypt myvpn.tlsauth to the line below it: /etc/openvpn/server.conf ;tls-auth ta.key 0 tls-crypt myvpn.tlsauth Save and exit the OpenVPN server configuration file (in nano, press CTRL - X, Y, then ENTER to do so), and then generate the static encryption key with the following command: sudo openvpn --genkey --secret /etc/openvpn/myvpn.tlsauth Now that your server is configured, you can move on to setting up the SSL keys and certificates needed to securely connect to your VPN connection. Step 3 — Generating Keys and Certificates Easy RSA uses a set of scripts that come installed with the program to generate keys and certificates. In order to avoid re-configuring every time you need to generate a certificate, you can modify Easy RSA’s configuration to define the default values it will use for the certificate fields, including your country, city, and preferred email address. We’ll begin our process of generating keys and certificates by creating a directory where Easy RSA will store any keys and certs you generate: sudo mkdir /etc/openvpn/easy-rsa/keys The default certificate variables are set in the vars file in /etc/openvpn/easy-rsa, so open that file for editing: sudo nano /etc/openvpn/easy-rsa/vars Scroll to the bottom of the file and change the values that start with export KEY_ to match your information. The ones that matter the most are: KEY_CN: Here, enter the domain or subdomain that resolves to your server. KEY_NAME: You should enter server here. If you enter something else, you would also have to update the configuration files that reference server.key and server.crt. The other variables in this file that you may want to change are: KEY_COUNTRY: For this variable, enter the two-letter abbreviation of the country of your residence. KEY_PROVINCE: This should be the name or abbreviation of the state of your residence. KEY_CITY: Here, enter the name of the city you live in. KEY_ORG: This should be the name of your organization or company. KEY_EMAIL: Enter the email address that you want to be connected to the security certificate. KEY_OU: This should be the name of the “Organizational Unit” to which you belong, typically either the name of your department or team. The rest of the variables can be safely ignored outside of specific use cases. After you’ve made your changes, the file should look like this: /etc/openvpn/easy-rsa/vars . . . # These are the default values for fields # which will be placed in the certificate. # Don't leave any of these fields blank. export KEY_COUNTRY="US" export KEY_PROVINCE="NY" export KEY_CITY="New York" export KEY_ORG="DigitalOcean" export KEY_EMAIL="sammy@example.com" export KEY_EMAIL=sammy@example.com export KEY_CN=openvpn.example.com export KEY_NAME="server" export KEY_OU="Community" . . . Save and close the file. To start generating the keys and certificates, move into the easy-rsa directory and source in the new variables you set in the vars file: cd /etc/openvpn/easy-rsa source ./vars Run Easy RSA’s clean-all script to remove any keys and certificates already in the folder and generate the certificate authority: ./clean-all Next, build the certificate authority with the build-ca script. You'll be prompted to enter values for the certificate fields, but if you set the variables in the vars file earlier, all of your options will already be set as the defaults. You can press ENTER to accept the defaults for each one: ./build-ca This script generates a file called ca.key. This is the private key used to sign your server and clients’ certificates. If it is lost, you can no longer trust any certificates from this certificate authority, and if anyone is able to access this file they can sign new certificates and access your VPN without your knowledge. For this reason, OpenVPN recommends storing ca.key in a location that can be offline as much as possible, and it should only be activated when creating new certificates. Next, create a key and certificate for the server using the build-key-server script: ./build-key-server server As with building the CA, you'll see the values you’ve set as the defaults so you can hit ENTER at these prompts. Additionally, you’ll be prompted to enter a challenge password and an optional company name. If you enter a challenge password, you will be asked for it when connecting to the VPN from your client. If you don’t want to set a challenge password, just leave this line blank and press ENTER. At the end, enter Y to commit the changes. The last part of creating the server keys and certificates is generating a Diffie-Hellman key exchange file. Use the build-dh script to do this: ./build-dh This may take a few minutes to complete. Once your server is finished generating the key exchange file, copy the server keys and certificates from thekeys directory into the openvpn directory: cd /etc/openvpn/easy-rsa/keys sudo cp dh2048.pem ca.crt server.crt server.key /etc/openvpn Each client will also need a certificate in order for the OpenVPN server to authenticate it. These keys and certificates will be created on the server and then you will have to copy them over to your clients, which we will do in a later step. It’s advised that you generate separate keys and certificates for each client you intend to connect to your VPN. Because we'll only set up one client here, we called it client, but you can change this to a more descriptive name if you’d like: cd /etc/openvpn/easy-rsa ./build-key client Finally, copy the versioned OpenSSL configuration file, openssl-1.0.0.cnf, to a versionless name, openssl.cnf. Failing to do so could result in an error where OpenSSL is unable to load the configuration because it cannot detect its version: cp /etc/openvpn/easy-rsa/openssl-1.0.0.cnf /etc/openvpn/easy-rsa/openssl.cnf Now that all the necessary keys and certificates have been generated for your server and client, you can move on to setting up routing between the two machines. Step 4 — Routing So far, you’ve installed OpenVPN on your server, configured it, and generated the keys and certificates needed for your client to access the VPN. However, you have not yet provided OpenVPN with any instructions on where to send incoming web traffic from clients. You can stipulate how the server should handle client traffic by establishing some firewall rules and routing configurations. Assuming you followed the prerequisites at the start of this tutorial, you should already have firewalld installed and running on your server. To allow OpenVPN through the firewall, you’ll need to know what your active firewalld zone is. Find this with the following command: sudo firewall-cmd --get-active-zones Output trusted Interfaces: tun0 Next, add the openvpn service to the list of services allowed by firewalld within your active zone, and then make that setting permanent by running the command again but with the --permanent option added: sudo firewall-cmd --zone=trusted --add-service openvpn sudo firewall-cmd --zone=trusted --add-service openvpn --permanent You can check that the service was added correctly with the following command: sudo firewall-cmd --list-services --zone=trusted Output openvpn Next, add a masquerade to the current runtime instance, and then add it again with the --permanentoption to add the masquerade to all future instances: sudo firewall-cmd --add-masquerade sudo firewall-cmd --permanent --add-masquerade You can check that the masquerade was added correctly with this command: sudo firewall-cmd --query-masquerade Output yes Next, forward routing to your OpenVPN subnet. You can do this by first creating a variable (SHARK in our example) which will represent the primary network interface used by your server, and then using that variable to permanently add the routing rule: SHARK=$(ip route get 8.8.8.8 | awk 'NR==1 {print $(NF-2)}') Be sure to implement these changes to your firewall rules by reloading firewalld: sudo firewall-cmd --reload Next, enable IP forwarding. This will route all web traffic from your client to your server’s IP address, and your client’s public IP address will effectively be hidden. Open sysctl.conf for editing: sudo nano /etc/sysctl.conf Then add the following line at the top of the file: /etc/sysctl.conf net.ipv4.ip_forward = 1 Finally, restart the network service so the IP forwarding will take effect: sudo systemctl restart network.service With the routing and firewall rules in place, we can start the OpenVPN service on the server. Step 5 — Starting OpenVPN OpenVPN is managed as a systemd service using systemctl. We will configure OpenVPN to start up at boot so you can connect to your VPN at any time as long as your server is running. To do this, enable the OpenVPN server by adding it to systemctl: sudo systemctl -f enable openvpn@server.service Then start the OpenVPN service: sudo systemctl start openvpn@server.service Double check that the OpenVPN service is active with the following command. You should see active (running) in the output: sudo systemctl status openvpn@server.service Output: We’ve now completed the server-side configuration for OpenVPN. Next, you will configure your client machine and connect to the OpenVPN server. Step 6 — Configuring a Client Regardless of your client machine's operating system, it will need a locally-saved copy of the CA certificate and the client key and certificate generated in Step 3, as well as the static encryption key you generated at the end of Step 2. Locate the following files on your server. If you generated multiple client keys with unique, descriptive names, then the key and certificate names will be different. In this article we used client. /etc/openvpn/easy-rsa/keys/ca.crt /etc/openvpn/easy-rsa/keys/client.crt /etc/openvpn/easy-rsa/keys/client.key /etc/openvpn/myvpn.tlsauth Copy these files to your client machine. You can use SFTP or your preferred method. You could even just open the files in your text editor and copy and paste the contents into new files on your client machine. Regardless of which method you use, be sure to note where you save these files. Next, create a file called client.ovpn on your client machine. This is a configuration file for an OpenVPN client, telling it how to connect to the server: sudo nano client.ovpn Then add the following lines to client.ovpn. Notice that many of these lines reflect those which we uncommented or added to the server.conf file, or were already in it by default: client.ovpn client tls-client ca /path/to/ca.crt cert /path/to/client.crt key /path/to/client.key tls-crypt /path/to/myvpn.tlsauth remote-cert-eku "TLS Web Client Authentication" proto udp remote your_server_ip 1194 udp dev tun topology subnet pull user nobody group nobody When adding these lines, please note the following: You'll need to change the first line to reflect the name you gave the client in your key and certificate; in our case, this is just client You also need to update the IP address from your_server_ip to the IP address of your server; port 1194 can stay the same Make sure the paths to your key and certificate files are correct This file can now be used by any OpenVPN client to connect to your server. Below are OS-specific instructions for how to connect your client: Windows: On Windows, you will need the official OpenVPN Community Edition binaries which come with a GUI. Place your .ovpn configuration file into the proper directory, C:\Program Files\OpenVPN\config, and click Connect in the GUI. OpenVPN GUI on Windows must be executed with administrative privileges. macOS: On macOS, the open source application Tunnelblick provides an interface similar to the OpenVPN GUI on Windows, and comes with OpenVPN and the required TUN/TAP drivers. As with Windows, the only step required is to place your .ovpn configuration file into the ~/Library/Application Support/Tunnelblick/Configurations directory. Alternatively, you can double-click on your .ovpn file. Linux: On Linux, you should install OpenVPN from your distribution's official repositories. You can then invoke OpenVPN by executing: sudo openvpn --config ~/path/to/client.ovpn After you establish a successful client connection, you can verify that your traffic is being routed through the VPN by checking Google to reveal your public IP. Conclusion You should now have a fully operational virtual private network running on your OpenVPN server. You can browse the web and download content without worrying about malicious actors tracking your activity. There are several steps you could take to customize your OpenVPN installation even further, such as configuring your client to connect to the VPN automatically or configuring client-specific rules and access policies. For these and other OpenVPN customizations, you should consult the official OpenVPN documentation. If you’re interested in other ways you can protect yourself and your machines on the internet, check out our article on 7 Security Measures to Protect Your Servers.
  10. Step 1 - Add Plex Repository The first step we need to do for this guide is to add the Plex repository to our CentOS 7 system. Go to the 'yum.repos.d' directory and create new repo file 'plex.repo' using the vim editor. cd /etc/yum.repos.d/ vim plex.repo Paste the following Plex repository configuration there. # Plex.repo file will allow dynamic install/update of plexmediaserver. [PlexRepo] name=PlexRepo baseurl=https://downloads.plex.tv/repo/rpm/$basearch/ enabled=1 gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key gpgcheck=1 Save and exit. Plex repository has been added to the CentOS 7 system. Step 2 - Install Plex Media Server on CentOS 7\8 Now we will install Plex media server on our CentOS server. Run the yum command below. sudo yum -y install plexmediaserver After the installation is complete, start the plex service and enable it to launch everytime at system boot using the systemctl commands below. systemctl start plexmediaserver systemctl enable plexmediaserver Plex media server has been installed - check it using the following command. systemctl status plexmediaserver And you will get the result as shown below. The Plex Media Server is now running on the CentOS 7 server. Step 2 - remove Plex Media Server on CentOS 7\8 To completely remove the Plex Media Server from the computer, first make sure the Plex Media Server is not running. Then do the following: Run the command rpm -e plexmediaserver Remove the directory /var/lib/plexmediaserver/ Run the command userdel plex Step 3 - Configure Firewalld Rules for Plex Media Server In this tutorial, we will enable Firewalld services. Make sure firewalld packages are installed on the system. Or you can install them using the yum command below. sudo yum -y install firewalld Now start the firewalld service and enable it to launch every time at system boot. systemctl start firewalld systemctl enable firewalld Next, we need to add new firewalld configuration for our plex installation. Plex media server needs some port in the 'LISTEN' state, so we will create new firewalld XML configuration. Go to the '/etc/firewalld/service' directory and create a new service firewalld configuration 'plex.xml' using vim. cd /etc/firewalld/services/ vim plexmediaserver.xml There, paste the following configuration. <?xml version="1.0" encoding="utf-8"?> <service> <short>plexmediaserver</short> <description>Ports required by plexmediaserver.</description> <port protocol="tcp" port="32400"></port> <port protocol="udp" port="1900"></port> <port protocol="tcp" port="3005"></port> <port protocol="udp" port="5353"></port> <port protocol="tcp" port="8324"></port> <port protocol="udp" port="32410"></port> <port protocol="udp" port="32412"></port> <port protocol="udp" port="32413"></port> <port protocol="udp" port="32414"></port> <port protocol="tcp" port="32469"></port> </service> Save and exit. Now add the 'plexmediaserver' service to the firewalld services list, then reload the configuration. sudo firewall-cmd --add-service=plexmediaserver --permanent sudo firewall-cmd --reload And you will get the result as below. The plexmediaserver service has been added to firewalld - check it using the firewalld command below. firewall-cmd --list-all And you should get 'plexmediaserver' on service list. Step 4 - Configure Plex Media Server Before configuring the Plex media server, make sure you have an account for Plex. If not, you can register using the URL below. https://app.plex.tv/ And then login to your account. If you're a registered user and logged in with your browser, you can open your Plex media server installation url in the following way. http://192.168.33.10:32400/web/ And you will be redirected to the plex login as below. Click the 'SIGN IN' button. And you will get the page about how plex works - just click the GOT IT button. Now the server setup page. Type your server name and click the 'NEXT' button. Now you will see the page for plex library configuration. Click the 'NEXT' button again. And the plexmediaserver configuration has been completed - click the 'DONE' button. And you will get the plex Dashboard. Now you can add media files to your plex media server. Below is an example library from our Plex installation. Plex Media Server installation and configuration on CentOS 7 server has been completed successfully.
  11. Install Samba4 in CentOS 7 1. First install Samba4 and required packages from the default CentOS repositories using the yum package manager tool as shown. # yum install samba samba-client samba-common Install Samba4 on CentOS 7 2. After installing the samba packages, enable samba services to be allowed through system firewall with these commands. # firewall-cmd --permanent --zone=public --add-service=samba # firewall-cmd --reload Open Samba on Firewalld Check Windows Machine Workgroup Settings 3. Before you proceed to configure samba, make sure the Windows machine is in the same workgroup to be configured on the CentOS server. There are two possible ways to view the Windows machine workgroup settings: Right clicking on “This PC” or “My Computer” → Properties → Advanced system settings → Computer Name. Check Windows WorkGroup Alternatively, open the cmd prompt and run the following command, then look for “workstation domain” in the output as shown below. >net config workstation Verify Windows WorkGroup Configuring Samba4 on CentOS 7 4. The main samba configuration file is /etc/samba/smb.conf, the original file comes with pre-configuration settings which explain various configuration directives to guide you. But, before configuring samba, I suggest you to take a backup of the default file like this. # cp /etc/samba/smb.conf /etc/samba/smb.conf.orig Then, proceed to configure samba for anonymous and secure file sharing services as explained below. Samba4 Anonymous File Sharing 5. First create the shared directory where the files will be stored on the server and set the appropriate permissions on the directory. # mkdir -p /srv/samba/anonymous # chmod -R 0775 /srv/samba/anonymous # chown -R nobody:nobody /srv/samba/anonymous Also, you need to change the SELinux security context for the samba shared directory as follows. # chcon -t samba_share_t /srv/samba/anonymous Create Samba Shared Directory 6. Next, open the samba configuration file for editing, where you can modify/add the sections below with the corresponding directives. # vi /etc/samba/smb.conf Samba Configuration Settings [global] workgroup = WORKGROUP netbios name = centos security = user [Anonymous] comment = Anonymous File Server Share path = /srv/samba/anonymous browsable =yes writable = yes guest ok = yes read only = no force user = nobody 7. Now verify current samba settings by running the command below. # testparm Verify Samba Current Configuration Settings Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[printers]" Processing section "[print$]" Processing section "[Anonymous]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions # Global parameters [global] netbios name = centos printcap name = cups security = USER idmap config * : backend = tdb cups options = raw [homes] comment = Home Directories browseable = No inherit acls = Yes read only = No valid users = %S %D%w%S [printers] comment = All Printers path = /var/tmp browseable = No printable = Yes create mask = 0600 [print$] comment = Printer Drivers path = /var/lib/samba/drivers create mask = 0664 directory mask = 0775 write list = root [Anonymous] comment = Anonymous File Server Share path = /srv/samba/anonymous force user = nobody guest ok = Yes read only = No 8. Finally, start and enable samba services to start automatically at next boot and also apply the above changes to take effect. # systemctl enable smb.service # systemctl enable nmb.service # systemctl start smb.service # systemctl start nmb.service Testing Anonymous Samba File Sharing 9. Now on the Windows machine, open “Network” from a Windows Explorer window, then click on the CentOShost, or else try to access the server using its IP address (use ifconfig command to get IP address). e.g. \\192.168.43.168. Shared Network Hosts 10. Next, open the Anonymous directory and try to add files in there to share with other users. Samba Anonymous Share Add Files to Samba Anonymous Share Setup Samba4 Secure File Sharing 11. First start by creating a samba system group, then add users to the group and set a password for each user like so. # groupadd smbgrp # usermod tecmint -aG smbgrp # smbpasswd -a tecmint 12. Then create a secure directory where the shared files will be kept and set the appropriate permissions on the directory with SELinux security context for the samba. # mkdir -p /srv/samba/secure # chmod -R 0770 /srv/samba/secure # chown -R root:smbgrp /srv/samba/secure # chcon -t samba_share_t /srv/samba/secure 13. Next open the configuration file for editing and modify/add the section below with the corresponding directives. # vi /etc/samba/smb.conf Samba Secure Configuration Settings [Secure] comment = Secure File Server Share path = /srv/samba/secure valid users = @smbgrp guest ok = no writable = yes browsable = yes 14. Again, verify the samba configuration settings by running the following command. $ testparm Verify Secure Configuration Settings Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[printers]" Processing section "[print$]" Processing section "[Anonymous]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions # Global parameters [global] netbios name = centos printcap name = cups security = USER idmap config * : backend = tdb cups options = raw [homes] comment = Home Directories browseable = No inherit acls = Yes read only = No valid users = %S %D%w%S [printers] comment = All Printers path = /var/tmp browseable = No printable = Yes create mask = 0600 [print$] comment = Printer Drivers path = /var/lib/samba/drivers create mask = 0664 directory mask = 0775 write list = root [Anonymous] comment = Anonymous File Server Share path = /srv/samba/anonymous force user = nobody guest ok = Yes read only = No [Secure] comment = Secure File Server Share path = /srv/samba/secure read only = No valid users = @smbgrp 15. Restart Samba services to apply the changes. # systemctl restart smb.service # systemctl restart nmb.service Testing Secure Samba File Sharing 16. Go to Windows machine, open “Network” from a Windows Explorer window, then click on the CentOS host, or else try to access the server using its IP address. e.g. \\192.168.43.168. You’ll be asked to provide your username and password to login the CentOS server. Once you have entered the credentials, click OK. Samba Secure Login 17. Once you successfully login, you will see all the samba shared directories. Now securely share some files with other permitted users on the network by dropping them in Secure directory.
  12. navigate to the following location. /etc/sysconfig/network-scripts/ in this location you will find your NIC file. modify the file with your editor of choice. BOOTPROTO=dhcp To: BOOTPROTO=static Now you'll need to add the entries to set not only the IP address, but the netmask, gateway, and DNS addresses. At the bottom of that file, add the following: IPADDR=192.168.1.200 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=1.0.0.1 DNS2=1.1.1.1 DNS3=8.8.4.4 Save the file restart networking sudo systemctl restart network
  13. Run the following: curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
  14. Plex is a free feature-rich media library platform that provides a way to store all your movies, shows, and other media in one place. You can access Plex from any device, whether you’re at home or on-the-go. There are many different media tools available in the world like, Kodi, Xmbc, OSMC and Mediatomb, but the Plex Media Server is perhaps one of the most popular solutions for managing media. Plex runs on Windows, macOS, Linux, FreeBSD and many more. Plex is a client-server media player system made up from two main components, 1) The Plex Media Server, which organizes music, photos and videos content from personal media libraries and streams it to their player, 2) The Players that can be the Plex web UI, Plex Apps or Plex home theater. Plex Media Server supports Chromecast, Amazon FireTV, Android, iOS, Xbox, PlayStation, Apple TV, Roku, Android TV and various types of smart TVs. If you are looking for a way to watch your movies from anywhere, then Plex is best choice for you. In this tutorial, we will learn how to install and configure Plex Media Server on Ubuntu 16.04. Requirements A server running Ubuntu 16.04. A not-root user with sudo privileges setup on your server. A static IP address 192.168.0.227 setup on your server. Getting Started Before starting, make sure your system is fully up to date by running the following command: sudo apt-get update -y sudo apt-get upgrade -y Once your system is updated, restart your system to apply all these changes with the following command: sudo reboot After restarting, log in with sudo user and proceed to the next step. 1. Install Plex Media Server First, you will need to download the latest version of the Plex from their official website. You can download it by running the following command: wget https://downloads.plex.tv/plex-media-server/1.7.5.4035-313f93718/plexmediaserver_1.7.5.4035-313f93718_amd64.deb Once Plex is downloaded, run the following command to install Plex: sudo dpkg -i plexmediaserver_1.7.5.4035-313f93718_amd64.deb Next, start Plex Media Server and enable it to start on boot time by running the following command: sudo systemctl start plexmediaserver sudo systemctl enable plexmediaserver You can check the status of Plex Media Server at any time by running the following command: sudo systemctl status plexmediaserver You should see the following output: ? plexmediaserver.service - Plex Media Server for Linux Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2017-08-05 11:48:52 IST; 17s ago Main PID: 3243 (sh) CGroup: /system.slice/plexmediaserver.service ??3243 /bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver "/usr/lib/plexmediaserver/Plex Media Server" ??3244 /usr/lib/plexmediaserver/Plex Media Server ??3288 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-313f93718/Framework.bundle/Contents/Resources/Versions/ Aug 05 11:49:04 Node1 systemd[1]: Started Plex Media Server for Linux. Aug 05 11:49:04 Node1 sh[3243]: Error in command line:the argument for option '--serverUuid' should follow immediately after the equal sign Aug 05 11:49:04 Node1 sh[3243]: Crash Uploader options (all are required): Aug 05 11:49:04 Node1 sh[3243]: --directory arg Directory to scan for crash reports Aug 05 11:49:04 Node1 sh[3243]: --serverUuid arg UUID of the server that crashed Aug 05 11:49:04 Node1 sh[3243]: --userId arg User that owns this product Aug 05 11:49:04 Node1 sh[3243]: --platform arg Platform string Aug 05 11:49:04 Node1 sh[3243]: --url arg URL to upload to Aug 05 11:49:04 Node1 sh[3243]: --help show help message Aug 05 11:49:04 Node1 sh[3243]: --version arg Version of the product Next, you will need to create a directory to store your Plex media. You can create this by running the following command: sudo mkdir -p /root/plex/movie Or if you already have shares on your server, skip this step Once you are finished, you can proceed to the next step. 2. Configure Plex Now, all the components are installed on your system, it's time to configure and access Plex. Open your web browser and type the URL http://192.168.0.227:32400/web, you should see the following page: After accepting the user agreement, you will need to create a Plex account, click on "Sign Up" button for a new account. You should see the following page: Here, provide all the required details like, Username, Email, Password, and click on the "Sign Up" button. You should see the following screen: Here, give your server name and click on the Next button, you should see the following screen: Click on the Next button, you should see the following screen: The final step of the initial server setup is to allow remote access to your media server and send anonymous data to Plex. By default both are checked. It is recommended to leave them checked, next click on the "Done" button to finish server setup. You should see the Plex dashboard in the following screen: Now, click on "Add Library" button, you should see the following screen: Here, select your library type. Repeat these steps for TV shows, music, and photos. It isn’t necessary to populate all the libraries. Click on the Nextbutton, you should see the following screen: Navigate to the corresponding media directory that you created previously, then click on Add button. Next, you will need to disable DLNA features. To do so, click the wrench icon in the upper right corner, select Server click on DLNA and uncheck "Enable the DLNA server" then click Save Changes. Congratulations! your Plex Media Server is ready, you are now ready to connect to it from your Plex client application or Web browser.
  15. brent

    How to disable IPv6

    To disable ipv6, you have to open /etc/sysctl.conf using any text editor and insert the following lines at the end: net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 If ipv6 is still not disabled, then the problem is that sysctl.conf is still not activated. To solve this, open a terminal(Ctrl+Alt+T) and type the command, sudo sysctl -p You will see this in the terminal: net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 After that, if you run: cat /proc/sys/net/ipv6/conf/all/disable_ipv6 It will report: 1 If you see 1, ipv6 has been successfully disabled.
  16. If you looking for an alternative to public IM and VOIP services like Skype and want to create a private secure IM / VOIP network, this guide is for you. This guide is intended as a relatively easy step by step guide to: Requirements: Ubuntu 12.04 or later installed machine to act as local IM server machine and one to act as IM client - the client computer can also be Windows or Mac OSX based as long as you install the relevant Spark client on these machines. 1. Install Java 6/7 JRE or JDK. On each computer you want to be part of your IM network require at least Java 6 JRE to be installed. Oracle / Sun Java 6 is no longer available in the Software Center as Oracle has changed the license to make it complicated to install and update on Ubuntu. More information about Java on Ubuntu available here. The easiest way I have found is to install Java on Ubuntu is via the Web Upd8 PPA . First add the PPA. Open a Terminal Window and enter : sudo add-apt-repository ppa:webupd8team/java sudo apt-get update A good idea to minimise any Java conflicts is to remove OpenJDK. open a Terminal Window and enter : sudo apt-get remove --purge openjdk* Then to install Oracle Java 6 version open a Terminal Window and enter : sudo apt-get install oracle-java6-installer To install Oracle Java 7 version open a Terminal Window and enter : sudo apt-get install oracle-java7-installer Tip: Top check the Java version installed on your system open a terminal and enter : java -version 2. Create new MySQL database for Openfire. You have several options for user authentication including LDAP, MtSQL or embeded DB. We will use the MySQL option and need to create a new database and user for Openfire to use. Log in to MySQL as root. Open the Terminal window and enter : sudo mysql -u root -p Then enter the following to create the database and add user openfire. Replace openfirepasswrd with a new password : mysql> CREATE DATABASE openfire CHARACTER SET='utf8'; mysql> CREATE USER 'openfire'@'localhost' IDENTIFIED BY 'openfirepasswrd'; mysql> GRANT ALL PRIVILEGES ON `openfire`.* TO 'openfire'@'localhost' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> quit 3. Install Openfire. The latest Debian version of Openfire can be downloaded from ignite realtime download page. Download Openfire 3.8.2 by opening a terminal window and enter : cd /tmp wget -O openfire_3.8.2_all.deb http://www.igniterea...e_3.8.2_all.deb Then install openfire. Open a Terminal window and enter : sudo dpkg -i openfire_3.8.2_all.deb Ignore all installation errors regarding user and folder permissions. As long as you do not get any Java version errors and openfire does install you are good to go. You need to point the openfire server startup file to the correct home folder of the Java version installed on your system. Replace java-6-sun with java-6-oracle or java-7-oracle depending on your version of java in the /etc/init.d/openfirefile in line 27, or open a terminal and enter: sudo apt-get install rpl sudo rpl '6-sun' '7-oracle' /etc/init.d/openfire sudo service openfire start 4. Open firewall ports for Openfire. You need to open some ports on your firewall for Openfire to work. Port 9090 : for the web interface. Port 9091 : for SSL web interface. Port 5222 : the main port used for client/server communication by Openfire. Port 7777 : used for file transfer. Port 7443 : used for unsecured Http client connections. Port 7070 : used for secure Http client connections. Port 3478, 3479 : used by the STUN Servive for entities behind a NAT. Complete port list used by Openfire available here. If you are using ufw firewall open a terminal and enter: sudo ufw allow 9090/tcp sudo ufw allow 9091/tcp sudo ufw allow 5222/tcp sudo ufw allow 7777/tcp sudo ufw allow 7443/tcp sudo ufw allow 7070/tcp sudo ufw allow 3478/tcp sudo ufw allow 3479/tcp 5. Configure Openfire server with web admin console. The rest of the Openfire configuration will be done in the admin console. Replace mydomain below with your FQDN or IP address of your server. Open a browser and go to : http://mydomain:9090/setup/index.jsp You will be presented with the Openfire setup wizard. Follow the instructions. When asked select Database Settings > Standard Connection Make sure you enter the MySQL database hostname and database name in the Database URL line below - this is easily missed . When done you can login to the admin console with your openfire admin username and password on : http://mydomain:9090/index.jsp You can also login securely with SSL encryption enabled on : https://mydomain:9091/index.jsp Some very important settings to consider are found under Server > Server Settings > Registration Settings Then go to the User/Groups menu and add IM users. How to remove openFire First we need to stop the service: sudo /etc/init.d/openfire stop Now we need to remove from services: sudo update-rc.d -f openfire remove Now to remove it from startup file: sudo rm /etc/init.d/openfire Now to delete all the files located at /opt/openfire: sudo rm -rf /opt/openfire Last Item is to dump the database in mysql.
  17. First you’ll need to login to your server, now lets begin by downloading the latest version of the Linux Teamspeak server:- https://www.teamspeak.com/downloads Head over to TeamSpeak and download the Server Linux version. Ok, so now lets extract the contents of the downloaded archive like so: (Current version of this article is 3.0.10.3) tar xzf teamspeak3-server_linux-amd64-3.0.10.3.tar.gz Next we’ll create a user account of which Teamspeak will run under on our server, we’ll simply use ‘teamspeak3’ as the username and disable the ability for a user to login to the server with this account (in effect making it a ‘local daemon account’ only) sudo adduser --disabled-login teamspeak3 Perfect! – Lets now move the Teamspeak binaries and configuration files into it’s new home, we’ll place these under /opt/ts3-server/ sudo mv teamspeak3-server_linux-amd64 /opt/ts3-server/ …and change the ownership to our ‘teamspeak3’ user that we set up a few minutes ago… sudo chown -R teamspeak3 /opt/ts3-server/ Fantastic, we are now very nearly done! – The last thing that we should do is to get Teamspeak to start on ‘boot up’ so first we will create a symlink (symbolic link) to the default init script that is included in the download archive:- sudo ln -s /opt/ts3-server/ts3server_startscript.sh /etc/init.d/teamspeak3 and now we set it to start on system boot up like so… sudo update-rc.d teamspeak3 defaults Here we go… we will now start the Teamspeak 3 server for the first time… sudo service teamspeak3 start You now have a Teamspeak 3 server up and running and as long as you’ve not got a firewall running you should now be able to connect to this server using your server’s hostname or IP address! (If you are running IPTables see my extended instructions below!) Just before you get carried away though, you should be shown a screen as follows: Adding firewall rules for IPTables If you have a firewall installed you’ll need to enable a few ports, if you are running IPtables on your server the rules required are as follows:- -A INPUT -p udp --dport 9987 -j ACCEPT -A INPUT -p udp --sport 9987 -j ACCEPT -A INPUT -p tcp --dport 30033 -j ACCEPT -A INPUT -p tcp --sport 30033 -j ACCEPT -A INPUT -p tcp --dport 10011 -j ACCEPT -A INPUT -p tcp --sport 10011 -j ACCEPT To manage your team speak server you can telnet into your server using putty, or you can download a client to manage the server using an interface here http://yat.qa/.
  18. How to install autosqlbackup First we want to: sudo apt-get update sudo apt-get upgrade Then we are going to run the following command. apt-get install automysqlbackup Next we want to edit the configuration file located /etc/default/automysqlbackup.conf /etc/default/autosqlbackup to see the stored location of backups look under sudo ls /var/lib/automysqlbackup You will see daily, monthly, and weekly I changed the default backup location to /opt/automysqlbackup/ This was done in /etc/default/automysqlbackup.conf P.S. You may also want to look at the following locations /usr/sbin/automysqlbackup /etc/cron.daily/automysqlbackup
  19. brent

    How to install LAMP

    How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04 Introduction A "LAMP" stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP. In this guide, we'll get a LAMP stack installed on an Ubuntu 16.04 Droplet. Ubuntu will fulfill our first requirement: a Linux operating system. Prerequisites Before you begin with this guide, you should have a separate, non-root user account with sudo privileges set up on your server. You can learn how to do this by completing steps 1-4 in the initial server setup for Ubuntu 16.04. Step 1: Install Apache and Allow in Firewall The Apache web server is among the most popular web servers in the world. It's well-documented, and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website. We can install Apache easily using Ubuntu's package manager, apt. A package manager allows us to install most software pain-free from a repository maintained by Ubuntu. For our purposes, we can get started by typing these commands: sudo apt-get update sudo apt-get install apache2 Since we are using a sudo command, these operations get executed with root privileges. It will ask you for your regular user's password to verify your intentions. Once you've entered your password, apt will tell you which packages it plans to install and how much extra disk space they'll take up. Press Y and hit Enter to continue, and the installation will proceed. Next, assuming that you have followed the initial server setup instructions to enable the UFW firewall, make sure that your firewall allows HTTP and HTTPS traffic. You can make sure that UFW has an application profile for Apache like so: sudo ufw app list Output Available applications: Apache Apache Full Apache Secure OpenSSH If you look at the Apache Full profile, it should show that it enables traffic to ports 80 and 443: sudo ufw app info "Apache Full" Output Profile: Apache Full Title: Web Server (HTTP,HTTPS) Description: Apache v2 is the next generation of the omnipresent Apache web server. Ports: 80,443/tcp Allow incoming traffic for this profile: sudo ufw allow in "Apache Full" You can do a spot check right away to verify that everything went as planned by visiting your server's public IP address in your web browser (see the note under the next heading to find out what your public IP address is if you do not have this information already): http://your_server_IP_address You will see the default Ubuntu 16.04 Apache web page, which is there for informational and testing purposes. If you see this page, then your web server is now correctly installed and accessible through your firewall. How To Find your Server's Public IP Address If you do not know what your server's public IP address is, there are a number of ways you can find it. Usually, this is the address you use to connect to your server through SSH. From the command line, you can find this a few ways. First, you can use the iproute2 tools to get your address by typing this: ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//' This will give you two or three lines back. They are all correct addresses, but your computer may only be able to use one of them, so feel free to try each one. An alternative method is to use the curl utility to contact an outside party to tell you how it sees your server. You can do this by asking a specific server what your IP address is: sudo apt-get install curl curl http://icanhazip.com Regardless of the method you use to get your IP address, you can type it into your web browser's address bar to get to your server. Step 2: Install MySQL Now that we have our web server up and running, it is time to install MySQL. MySQL is a database management system. Basically, it will organize and provide access to databases where our site can store information. Again, we can use apt to acquire and install our software. This time, we'll also install some other "helper" packages that will assist us in getting our components to communicate with each other: sudo apt-get install mysql-server Note: In this case, you do not have to run sudo apt-get update prior to the command. This is because we recently ran it in the commands above to install Apache. The package index on our computer should already be up-to-date. Again, you will be shown a list of the packages that will be installed, along with the amount of disk space they'll take up. Enter Y to continue. During the installation, your server will ask you to select and confirm a password for the MySQL "root" user. This is an administrative account in MySQL that has increased privileges. Think of it as being similar to the root account for the server itself (the one you are configuring now is a MySQL-specific account, however). Make sure this is a strong, unique password, and do not leave it blank. When the installation is complete, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit. Start the interactive script by running: sudo mysql_secure_installation You will be asked to enter the password you set for the MySQL root account. Next, you will be asked if you want to configure the VALIDATE PASSWORD PLUGIN. Warning: Enabling this feature is something of a judgment call. If enabled, passwords which don't match the specified criteria will be rejected by MySQL with an error. This will cause issues if you use a weak password in conjunction with software which automatically configures MySQL user credentials, such as the Ubuntu packages for phpMyAdmin. It is safe to leave validation disabled, but you should always use strong, unique passwords for database credentials. Answer y for yes, or anything else to continue without enabling. VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: You'll be asked to select a level of password validation. Keep in mind that if you enter 2, for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words. There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 If you enabled password validation, you'll be shown a password strength for the existing root password, and asked you if you want to change that password. If you are happy with your current password, enter nfor "no" at the prompt: Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : n For the rest of the questions, you should press Y and hit the Enter key at each prompt. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes we have made. At this point, your database system is now set up and we can move on. Step 3: Install PHP PHP is the component of our setup that will process code to display dynamic content. It can run scripts, connect to our MySQL databases to get information, and hand the processed content over to our web server to display. We can once again leverage the apt system to install our components. We're going to include some helper packages as well, so that PHP code can run under the Apache server and talk to our MySQL database: sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql This should install PHP without any problems. We'll test this in a moment. In most cases, we'll want to modify the way that Apache serves files when a directory is requested. Currently, if a user requests a directory from the server, Apache will first look for a file called index.html. We want to tell our web server to prefer PHP files, so we'll make Apache look for an index.php file first. To do this, type this command to open the dir.conf file in a text editor with root privileges: sudo nano /etc/apache2/mods-enabled/dir.conf It will look like this: /etc/apache2/mods-enabled/dir.conf <IfModule mod_dir.c> DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule> We want to move the PHP index file highlighted above to the first position after the DirectoryIndexspecification, like this: /etc/apache2/mods-enabled/dir.conf <IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm </IfModule> When you are finished, save and close the file by pressing Ctrl-X. You'll have to confirm the save by typingY and then hit Enter to confirm the file save location. After this, we need to restart the Apache web server in order for our changes to be recognized. You can do this by typing this: sudo systemctl restart apache2 We can also check on the status of the apache2 service using systemctl: sudo systemctl status apache2 Sample Output ● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: active (running) since Wed 2016-04-13 14:28:43 EDT; 45s ago Docs: man:systemd-sysv-generator(8) Process: 13581 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS) Process: 13605 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS) Tasks: 6 (limit: 512) CGroup: /system.slice/apache2.service ├─13623 /usr/sbin/apache2 -k start ├─13626 /usr/sbin/apache2 -k start ├─13627 /usr/sbin/apache2 -k start ├─13628 /usr/sbin/apache2 -k start ├─13629 /usr/sbin/apache2 -k start └─13630 /usr/sbin/apache2 -k start Apr 13 14:28:42 ubuntu-16-lamp systemd[1]: Stopped LSB: Apache2 web server. Apr 13 14:28:42 ubuntu-16-lamp systemd[1]: Starting LSB: Apache2 web server... Apr 13 14:28:42 ubuntu-16-lamp apache2[13605]: * Starting Apache httpd web server apache2 Apr 13 14:28:42 ubuntu-16-lamp apache2[13605]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerNam Apr 13 14:28:43 ubuntu-16-lamp apache2[13605]: * Apr 13 14:28:43 ubuntu-16-lamp systemd[1]: Started LSB: Apache2 web server.
  20. Command Line Partitioning You'll be using "fdisk" to accomplish this. Refer back to the logical name you noted from earlier. For illustration, I'll use /dev/sdb, and assume that you want a single partition on the disk, occupying all the free space. If the number of cylinders in the disk is larger than 1024 (and large hard drives always have more), it could, in certain setups, cause problems with: software that runs at boot time (e.g., old versions of LILO) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Otherwise, this will not negatively affect you. 1) Initiate fdisk with the following command: sudo fdisk /dev/sdb 2) Fdisk will display the following menu: Command (m for help): m <enter> Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): 3) We want to add a new partition. Type "n" and press enter. Command action e extended p primary partition (1-4) 4) We want a primary partition. Enter "p" and enter. Partition number (1-4): 5) Since this will be the only partition on the drive, number 1. Enter "1" and enter. Command (m for help): If it asks about the first cylinder, just type "1" and enter. (We are making 1 partition to use the whole disk, so it should start at the beginning.) 6) Now that the partition is entered, choose option "w" to write the partition table to the disk. Type "w" and enter. The partition table has been altered! 7) If all went well, you now have a properly partitioned hard drive that's ready to be formatted. Since this is the first partition, Linux will recognize it as /dev/sdb1, while the disk that the partition is on is still /dev/sdb. Command Line Formatting To format the new partition as ext3 file system (best for use under Ubuntu): sudo mkfs -t ext3 /dev/sdb1 To format the new partition as fat32 file system (best for use under Ubuntu & Windows): sudo mkfs -t fat32 /dev/sdb1 As always, substitute "/dev/sdb1" with your own partition's path. Modify Reserved Space (Optional) When formatting the drive as ext2/ext3, 5% of the drive's total space is reserved for the super-user (root) so that the operating system can still write to the disk even if it is full. However, for disks that only contain data, this is not necessary. NOTE: You may run this command on a fat32 file system, but it will do nothing; therefore, I highly recommend not running it. You can adjust the percentage of reserved space with the "tune2fs" command, like this: sudo tune2fs -m 1 /dev/sdb1 This example reserves 1% of space - change this number if you wish. Using this command does not change any existing data on the drive. You can use it on a drive which already contains data. Create A Mount Point Now that the drive is partitioned and formatted, you need to choose a mount point. This will be the location from which you will access the drive in the future. I would recommend using a mount point with "/media", as it is the default used by Ubuntu. For this example, we'll use the path "/media/mynewdrive" sudo mkdir /media/mynewdrive Now we are ready to mount the drive to the mount point. Mount The Drive You can choose to have the drive mounted automatically each time you boot the computer, or manually only when you need to use it. Automatic Mount At Boot Note: Ubuntu now recommends to use UUID instead, see the instructions here:https://help.ubuntu....unity/UsingUUID You'll need to edit /etc/fstab: gksu gedit /etc/fstab or in terminal: sudo nano -Bw /etc/fstab Note: https://help.ubuntu....b#Editing_fstab Add this line to the end (for ext3 file system): /dev/sdb1 /media/mynewdrive ext3 defaults 0 2 Add this line to the end (for fat32 file system): /dev/sdb1 /media/mynewdrive vfat defaults 0 2The defaults part may allow you to read, but not write. To write other partition and FAT specific options must be used. If gnome nautilus is being used, use the right-click, mount method, from computer folder. Then launch the mount command from terminal, no options. The last entry should be the FAT drive and and look something like: /dev/sda5 on /media/mynewdrive type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)All of the parts between the parenthesis are the mount options and should replace "defaults" in the fstab file. The "2" at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to "0" will skip this. Run 'man fstab' for more info here. You can now run "sudo mount -a" (or reboot the computer) to have the changes take effect. If you want to allow a normal user to create files on this drive, you can either give this user ownership of the top directory of the drive filesystem: (replace USERNAME with the username) sudo chown -R USERNAME:USERNAME /media/mynewdrive or in a more flexible way, practical if you have several users, allow for instance the users in the plugdev group (usually those who are meant to be able to mount removable disks, desktop users) to create files and sub-directories on the disk: sudo chgrp plugdev /media/mynewdrive sudo chmod g+w /media/mynewdrive sudo chmod +t /media/mynewdrive The last "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod). Manually Mount Alternatively, you may want to manually mount the drive every time you need it. For manual mounting, use the following command: sudo mount /dev/sdb1 /media/mynewdrive When you are finished with the drive, you can unmount it using: sudo umount /media/mynewdrive
  21. This guide was created on Ubuntu 12.04. This has also been tested on 16.04 Introduction: The installation of OpenVPN AS is much simpler compared to the traditional OpenVPN (without any GUI). Another great thing about about OpenVPN AS (Access Server) is that it has a mobile application for both Android and iOS platforms, enabling you to access your OpenVPN server on your smartphone as well. Basic Server Setup The ports that you need forwarded are as followed. 443, TCP 943, UDP 1194 Installing OpenVPN Acess Server (Visit openvpn.org for latest version) sudo wget http://swupdate.openvpn.org/as/openvpn-as-2.0.7-Ubuntu12.amd_64.deb To install OpenVPN AS, enter the following command: dpkg -i openvpn-as-2.0.7-Ubuntu12.amd_64.deb That's it. OpenVPN AS is now installed. However, there are still some things left to do before we can use it. During the installation, OpenVPN has created a default admin user called 'openvpn'. We need to set a password for 'openvpn'. To do that, enter the following command: sudo passwd openvpn Administration and Client Software SetupReplace "YourIPAddress" with your actual cloud server's IP address. Then, head over to the Client UI to use the access server. You'll see a big bad security warning. But don't be alarmed, it is perfectly okay since we've self-signed our server's SSL. Ignore the warning and click Ok/Proceed and you'll be prompted for username and password. Enter 'openvpn' as the username and the password should be what you've set for 'openvpn' before. After filling out username/password, click 'Go' and you'll see a screen like this: You can login to the Admin UI if you need to make changes to your access server, although default settings works fine. Now, have fun with your OpenVPN Access Server! https://domain.com:943/admin/
  22. If you have a start up script in init.d and want to remove the start up service here is the command. update-rc.d -f foobar remove
  23. Here is an example of how to use rysnc to copy data from a server to a remote server over SSH. rsync -av --progress /home/shares/data/ brent@10.123.153.129: /home/shares/data
  24. https://www.alfresco.com This document shows how to install Alfresco 4.2 on an Ubuntu 12.04 system. I am creating a virtual server for this that has 3.75 GiB of Memory Installing Java 7 Here are the commands to install Java 7 from Ubuntu 12.04 server. > sudo apt-get purge openjdk* > sudo apt-get install python-software-properties > sudo add-apt-repository ppa:webupd8team/java > sudo apt-get update > sudo apt-get install oracle-java7-installer > java -version Install Tomcat 7 ( a lot of this was derived from http://jensontaylor....-on-ubuntu.html ) · Download tomcat 7 to the local directory (this address could change see http://tomcat.apache...download-70.cgi [2]) > wget http://apache.osuosl.org/tomcat/tomcat-7/v7.0.50/bin/apache-tomcat-7.0.50.tar.gz Extract the file > tar xvzf apache-tomcat-7.0.50.tar.gz Move the tomcat over > sudo mv apache-tomcat-7.0.50 /opt/tomcat Now set up the tomcat users. > sudo nano /opt/tomcat/conf/tomcat-users.xml Add the following lines within the <tomcat-users> element (of course change the password to your own password) <role rolename="manager-gui"/> <role rolename="admin-gui"/> <user name="admin" password="password" roles="admin-gui, manager-gui, manager-script, admin-script" /> Fix the connector, > sudo nano +70 /opt/tomcat/conf/server.xml And add this to the connector URIEncoding="UTF-8" Set up start up script > sudo nano /etc/init.d/tomcat Then place the following in it. (adjust the jvm to the directory you have it in) # Tomcat auto-start # # description: Auto-starts tomcat # processname: tomcat # pidfile: /var/run/tomcat.pid export JAVA_HOME=/usr/lib/jvm/java-7-oracle case $1 in start) sh /opt/tomcat/bin/startup.sh ;; stop) sh /opt/tomcat/bin/shutdown.sh ;; restart) sh /opt/tomcat/bin/shutdown.sh sh /opt/tomcat/bin/startup.sh ;; esac exit 0 Make it executable > sudo chmod 755 /etc/init.d/tomcat Add it to autostart > sudo update-rc.d tomcat defaults Reboot to test auto start of tomcat > sudo reboot now Now open up a web browser (of course use your IP address, domain name) Change memory settings for tomcat > sudo nano /opt/tomcat/bin/catalina.sh Add the following line This gives it 2GiB to use, you may need to change it to your system JAVA_OPTS="-XX:MaxPermSize=160m -XX:NewSize=256m -Xms512m " JAVA_OPTS="$JAVA_OPTS -Xmx1024m -Xss512K " Restart tomcat > sudo /etc/init.d/tomcat restart Open up http://192.168.2.110.../manager/status to check the memory settings Here you can see here that it does have 2GiB of max memory (roughly) Install/Setup MySQL Install mysql on this server > sudo apt-get install mysql-server Log into mysql > mysql -u root -p -h localhost Run this command in mysql to create alfresco user and to give it alfresco access > CREATE USER 'alfresco'@'localhost' IDENTIFIED BY 'passalfresco'; > CREATE USER 'alfresco'@'%' IDENTIFIED BY 'passalfresco'; > grant all on alfresco.* to 'alfresco'@'%' identified by 'passalfresco' with grant option; > create database alfresco default character set utf8 collate utf8_bin; > exit Restart mysql > sudo /etc/init.d/mysql restart Create Alfresco Folder Make a alfresco folder > sudo mkdir /opt/alfresco Download Install Alfresco Some of the notes I used for this are at http://wiki.alfresco...fresco_in_Linux [3] Download the installer (this address will change over time) but you can probably be safe going to http://wiki.alfresco...nstall_Alfresco [4] or http://wiki.alfresco...file_list_4.2.c > cd > mkdir alfresco > cd alfresco > sudo sudo http://dl.alfresco.com/release/community/build-4848/alfresco-community-4.2.e.zip If you do not have unzip install it. > sudo apt-get install unzip unzip file > unzip alfresco-community-4.2.e.zip Install alfresco.war and share.war on tomcat Open up the tomcat web page http://192.168.0.231:8080/manager/html Then enter Context Path /alfresco War Directory /opt/alfresco/web-server/webapps/alfresco.war Click Deploy It will deploy but fail to start (which is fine) Now do the same for share.war Then enter Context Path /share War Directory /opt/alfresco/web-server/webapps/share.war Click Deploy Download and install mysql connector, it can be found at http://dev.mysql.com...ds/connector/j/ [5] > cd > wget http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.28.zip > unzip mysql-connector-java-5.1.28.zip > cd mysql-connector-java-5.1.28/ > cp mysql-connector-java-5.1.28-bin.jar /opt/tomcat/lib/ setup the shared directory > cd > cd /opt/alfresco/web-server > sudo cp -r shared /opt/tomcat/ Set Global Properties Alfresco requires some additional installs to work. Alfresco out of the box uses a few other tools like OpenOffice and ImageMagick. Some of this was gleamed from http://www.howtoforg...0.04-lucid-lynx [6] First update your repository information > sudo apt-add-repository ppa:guilhem-fr/swftools > sudo add-apt-repository ppa:upubuntu-com/office > sudo apt-get update Install these via apt-get > sudo apt-get install imagemagick swftools libjodconverter-java ffmpeg ttf-mscorefonts-installer Copy these sample files to .xml files (it will allow the creation of thumbnails for videos) > cd /opt/tomcat/shared/classes/alfresco/extension/ > sudo cp video-thumbnail-context.xml.sample video-thumbnail-context.xml > sudo cp video-transformation-context.xml.sample video-transformation-context.xml Edit the /opt/tomcat/conf/catalina.properties file > sudo nano +74 /opt/tomcat/conf/catalina.properties Updated shared.loader to the following shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar In the /opt/tomcat/shared/classes directory there is an alfresco-global.properties.sample folder. Rename it > cd /opt/tomcat/shared/classes > sudo cp alfresco-global.properties.sample alfresco-global.properties Now edit this file > sudo nano alfresco-global.properties Here is the file I made, Make sure to edit the mail.* portion to an email account you have. (new in ubuntu 12.04 open office is now libreoffice) ############################### ## Common Alfresco Properties # ############################### # # Sample custom content and index data location # dir.root=/opt/alfresco/alf_data #dir.keystore=${dir.root}/keystore # # Sample database connection properties # db.username=alfresco db.password=Sp23rty4 #Disabled the guest login alfresco.authentication.allowGuestLogin=false # # External locations #------------- ooo.exe=/usr/bin/libreoffice ooo.enabled=true ooo.port=8100 jodconverter.officeHome=/usr/lib/libreoffice/program/soffice jodconverter.portNumbers=8100 jodconverter.enabled=true img.root=/usr img.dyn=${img.root}/lib img.exe=${img.root}/bin/convert swf.exe=/usr/bin/pdf2swf ffmpeg.exe=/usr/bin/ffmpeg # # Property to control whether schema updates are performed automatically. # Updates must be enabled during upgrades as, apart from the static upgrade scripts, # there are also auto-generated update scripts that will need to be executed. After # upgrading to a new version, this can be disabled. # #db.schema.update=true # # MySQL connection # db.driver=org.gjt.mm.mysql.Driver db.name=alfresco db.url=jdbc:mysql://localhost/alfresco?useUnicode=yes&characterEncoding=UTF-8 # # Oracle connection # #db.driver=oracle.jdbc.OracleDriver #db.url=jdbc:oracle:thin:@localhost:1521:alfresco # # PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent) # #db.driver=org.postgresql.Driver #db.url=jdbc:postgresql://localhost:5432/alfresco # # DB2 connection # #db.driver=com.ibm.db2.jcc.DB2Driver #db.url=jdbc:db2://localhost:50000/alfresco:retrieveMessagesFromServerOnGetMessage=true; # # Index Recovery Mode #------------- #index.recovery.mode=AUTO # # Outbound Email Configuration #------------- mail.host=smtp.gmail.com mail.port=465 mail.protocol=smtps mail.username=yourname@example.com mail.password=yourpassword mail.smtp.timeout=30000 # New Properties mail.smtps.starttls.enable=true mail.smtps.auth=true # # Alfresco Email Service and Email Server #------------- # Enable/Disable the inbound email service. The service could be used by processes other than # the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service. #------------- #email.inbound.enabled=true # Email Server properties #------------- #email.server.enabled=true #email.server.port=25 #email.server.domain=alfresco.com #email.inbound.unknownUser=anonymous # A comma separated list of email REGEX patterns of allowed senders. # If there are any values in the list then all sender email addresses # must match. For example: # .*\@alfresco\.com, .*\@alfresco\.org # Allow anyone: #------------- #email.server.allowed.senders=.* # # The default authentication chain # To configure external authentication subsystems see: # http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems #------------- #authentication.chain=alfrescoNtlm1:alfrescoNtlm # # URL Generation Parameters (The ${localname} token is replaced by the local server name) #------------- #alfresco.context=alfresco #alfresco.host=${localname} #alfresco.port=8080 #alfresco.protocol=http # #share.context=share #share.host=${localname} #share.port=8080 #share.protocol=http #imap.server.enabled=true #imap.server.port=143 #imap.server.host=localhost # Default value of alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'. # This allows connections to JMX both remotely and locally. # alfresco.rmi.services.host=0.0.0.0 # # RMI service ports for the individual services. # These seven services are available remotely. # # Assign individual ports for each service for best performance # or run several services on the same port. You can even run everything on 50500 if needed. # # Select 0 to use a random unused port. # #avm.rmi.service.port=50501 #avmsync.rmi.service.port=50502 #attribute.rmi.service.port=50503 #authentication.rmi.service.port=50504 #repo.rmi.service.port=50505 #action.rmi.service.port=50506 #wcm-deployment-receiver.rmi.service.port=50507 #monitor.rmi.service.port=50508 Reboot the server >sudo reboot now It may take a while for alfresco to come up and set up the database the first time. What I do is log back into the system them tail the tomcat log to see if alfresco is starting correctly, and for when it is done (in my case it took 2 ½ minutes) > sudo tail -f /opt/tomcat/logs/catalina.out See the server startup message.
  25. Here is the command to clean cache from your server. sudo echo 3 | sudo tee /proc/sys/vm/drop_caches
×
×
  • Create New...