Editing
Migrating MS SQL and Upgrading Nginx Version
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Migrating MS SQL (2008 R2 to 2016) ----------------------------------- - ncc1701d.apoyar (Old Server β 2008R2) - TempNCC (New Server β 2016) Login to old server (ncc1701d.apoyar) β’ Open SQL management studio (connect) β’ Select service type β’ Select name β’ Connect Database backup in SQL management studio β’ Expand databases β’ Select and right click database β’ Task β’ Backup β’ Select full backup β’ Database name leave as it is β’ Select DISC option and keep location as it is (default) β’ Name the backup file with (.bak) extension β’ Click OK Disable logon on Terminal Server β’ Connect to server β’ Open command prompt β’ Run below command - change logon /disable Connect to New server (TempNCC) β’ Browse for backup files on old server through file explorer β’ Copy the files to new server β’ Rename the old server β’ Rename the new server (give it the old serverβs name) Open SQL management studio, click on New Query Write and execute below queries -- Get the file list from a backup file. -- This will show you current logical names and paths in the BAK file RESTORE FILELISTONLY FROM disk = N'C:\Backups\MyDatabaseName.bak' -- Perform the restore of the database from the backup file. -- Replace 'move' names (MDFLogicalName, LDFLogicalName) with those found in -- the previous filelistonly command restore database MyDatabaseName from disk = N'C:\Backups\MyDatabaseName.bak' with move 'MDFLogicalName' to 'D:\SQLData\MyDatabaseName.mdf', move 'LDFLogicalName' to 'D:\SQLLogs\MyDatabaseName_log.ldf', replace, stats=10; Upgrading Version of Nginx --------------------------------- Login to Server (on which need to update Nginx version) β’ Cd /home/neal/root/ Download the nginx source β’ wget http://nginx.org/download/nginx-1.18.0.tar.gz Unzip the downloaded file β’ tar xzvf filename β’ Nginx βV Copy the configuration modules in text Open the server with latest SSL version (demo.apoyar) β’ Nginx βV Copy the last configuration command with SSL and paste it in text document at last Download the open SSL source β’ Go to cd /usr/local/src/ β’ wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz β’ tar xzvf filename β’ go to cd root/ β’ go to nginx folder Paste here that configuration module which we have in text document and hit enter NOTE: - If getting any errors, troubleshoot with the below steps as per errors coming across. If the ./configure gives you any errors, take the following steps: apt-get install uuid-dev If ./configure gives you an error about psol not found apt-get install libgd-dev in case of this error: ./configure: error: the HTTP image filter module requires the GD library. apt-get install libgeoip-dev in case of: ./configure: error: the GeoIP module requires the GeoIP library. install libssl-dev in case of: ./configure: error: SSL modules require the OpenSSL library. install libpcre++-dev in case of: ./configure: error: the HTTP rewrite module requires the PCRE library. apt-get install libxslt1-dev in case of: ./configure: error: the HTTP XSLT module requires the libxml2/libxslt apt-get install zlib1g-dev ./configure: error: the HTTP gzip module requires the zlib library apt-get install libpam0g-dev in case of: make gives you an error: fatal error: security/pam_appl.h: No such file or directory Then run below command β’ make Uninstall OLD Nginx β’ Cd etc/ β’ tar czvf nginx β’ mv nginx /root/ β’ dpkg β I l grep nginx β’ apt-get purge nginx After removing old nginx reboot the server Installing NEW Nginx β’ Cd /root/nginx 1.18.0 β’ Nginx βv If the nginx command doesn't work, create a symlink: β’ ln -s /usr/share/nginx/sbin/nginx /usr/sbin/Ln β’ Nginx βV β’ Go to cd etc/ β’ tar xzvf nginx 1.18.0 Go to Cd /nginx/sites-enabled Check syntax and potential errors: β’ sudo nginx βt # Will throw this error nginx: [emerg] mkdir() "/var/lib/nginx/body" failed (2: No such file or directory) # Just create directory β’ mkdir -p /var/lib/nginx && sudo nginx βt Create systemd unit file for NGINX: β’ sudo vim /etc/systemd/system/nginx.service Copy/paste the following content: NOTE: The location of the PID file and the NGINX binary may be different depending on how NGINX was compiled. [Unit] Description=A high performance web server and a reverse proxy server After=network.target [Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;' ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;' ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid TimeoutStopSec=5 KillMode=mixed [Install] WantedBy=multi-user.target Start and enable NGINX service: β’ sudo systemctl start nginx.service && sudo systemctl enable nginx.service Create UFW NGINX application profile: β’ sudo vim /etc/ufw/applications.d/nginx Copy/paste the following content: [Nginx HTTP] title=Web Server (Nginx, HTTP) description=Small, but very powerful and efficient web server ports=80/tcp [Nginx HTTPS] title=Web Server (Nginx, HTTPS) description=Small, but very powerful and efficient web server ports=443/tcp [Nginx Full] title=Web Server (Nginx, HTTP + HTTPS) description=Small, but very powerful and efficient web server ports=80,443/tcp Now, verify that UFW app profiles are created and recognized: β’ sudo ufw app list # Available applications: # Nginx Full # Nginx HTTP # Nginx HTTPS # OpenSSH
Summary:
Please note that all contributions to Apoyar Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Apoyar Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Apoyar Infrastructure
Active Directory
Recent changes
Random page
Upload file
Tools
What links here
Related changes
Special pages
Page information